[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#867869: ITP: beautify-bash -- Beautifier for Bash shell scripts written in Python



[2017-07-10 02:42] Mike Mestnik <cheako@mikemestnik.net>
> Package: wnpp
> Severity: wishlist
> Owner: Mike Mestnik <cheako@mikemestnik.net>
>
> * License         : GPL
>   Programming Lang: Python
>   Description     : Beautifier for Bash shell scripts written in Python
>
> Second Bash script beautifier by Paul Lutus — the first is pretty
> well-known.  This rewrite cleans up some annoying inconsistencies.

I read description of program, and its first sentence is "I decided to
not recreate Bash parser". Hey, that is idea!

If "foo" is bash function, then "type foo" outputs its body,
pretty-printed.  So, here is complex example from upstream website:

	_fn () {
		for arg ; do
		done=3; echo done; done
	}

Here is output of "type _fn":

	_fn is a function
	_fn () 
	{ 
	    for arg in "$@";
	    do
		done=3;
		echo done;
	    done
	}

So, we can put script into body of function, and bash would pretty-print
it. Unfortunately, it eats comments. Hope this idea could be of use to
somebody.
-- 
Note, that I send and fetch email in batch, once in a few days.


Reply to: