zsh-users
 help / color / mirror / code / Atom feed
* 'indent' for zsh files?
@ 2011-12-11 23:56 TJ Luoma
  2011-12-12 11:41 ` Stephane CHAZELAS
  0 siblings, 1 reply; 5+ messages in thread
From: TJ Luoma @ 2011-12-11 23:56 UTC (permalink / raw)
  To: Zsh Users


Is there a similar program to 'indent' which can reformat ('prettify') zsh shell scripts?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 'indent' for zsh files?
  2011-12-11 23:56 'indent' for zsh files? TJ Luoma
@ 2011-12-12 11:41 ` Stephane CHAZELAS
  2011-12-12 13:35   ` Eitan Adler
  0 siblings, 1 reply; 5+ messages in thread
From: Stephane CHAZELAS @ 2011-12-12 11:41 UTC (permalink / raw)
  To: zsh-users

2011-12-11, 18:56(-05), TJ Luoma:
>
> Is there a similar program to 'indent' which can reformat ('prettify') zsh shell scripts?

vim can do it to some extent.

-- 
Stephane


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 'indent' for zsh files?
  2011-12-12 11:41 ` Stephane CHAZELAS
@ 2011-12-12 13:35   ` Eitan Adler
  2011-12-12 17:30     ` ZSH Users
  0 siblings, 1 reply; 5+ messages in thread
From: Eitan Adler @ 2011-12-12 13:35 UTC (permalink / raw)
  To: zsh-users

On Mon, Dec 12, 2011 at 6:41 AM, Stephane CHAZELAS
<stephane_chazelas@yahoo.fr> wrote:
> 2011-12-11, 18:56(-05), TJ Luoma:
>>
>> Is there a similar program to 'indent' which can reformat ('prettify') zsh shell scripts?
>
> vim can do it to some extent.

Also try 'functions'.

What exactly is your goal here?


-- 
Eitan Adler


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 'indent' for zsh files?
  2011-12-12 13:35   ` Eitan Adler
@ 2011-12-12 17:30     ` ZSH Users
  2011-12-13  7:03       ` Martin Richter
  0 siblings, 1 reply; 5+ messages in thread
From: ZSH Users @ 2011-12-12 17:30 UTC (permalink / raw)
  To: zsh-users


 2011-12-11, 18:56(-05), TJ Luoma:
>
> Is there a similar program to 'indent' which can reformat ('prettify')
> zsh shell scripts?

I've been using TextMate to edit and indent my ZSH scripts. 

It's got bundles for both bash and zsh scripts.

Darryl


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 'indent' for zsh files?
  2011-12-12 17:30     ` ZSH Users
@ 2011-12-13  7:03       ` Martin Richter
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Richter @ 2011-12-13  7:03 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-13  7:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-11 23:56 'indent' for zsh files? 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

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).