From: Martin Richter <lawn.mower@gmx.de>
To: zsh-users@zsh.org
Subject: Re: 'indent' for zsh files?
Date: Tue, 13 Dec 2011 08:03:32 +0100 [thread overview]
Message-ID: <201112130803.35043.lawn.mower@gmx.de> (raw)
In-Reply-To: <f630267f7317a3df41ebc50c61a28fe9@localhost>
If you want to do it interactively you could write the script to a tempory file and then use emacs in batch-mode
#-------------------------------
prettify-script-filter() {
# first create a temporary file
local tmp_file
tmp_file=$(tempfile)
cat >! $tmp_file &&
emacs --batch $tmp_file \
-f shell-script-mode \
-f mark-whole-buffer \
-f indent-region \
-f save-buffer &&
cat $tmp_file
rm -rf $tmp_file
}
#-------------------------------
and then do something like
cat myscript.sh | prettify-script-filter
Martin
prev parent reply other threads:[~2011-12-13 7:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-11 23:56 TJ Luoma
2011-12-12 11:41 ` Stephane CHAZELAS
2011-12-12 13:35 ` Eitan Adler
2011-12-12 17:30 ` ZSH Users
2011-12-13 7:03 ` Martin Richter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201112130803.35043.lawn.mower@gmx.de \
--to=lawn.mower@gmx.de \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).