On Sat, Dec 4, 2010 at 10:33 PM, Dylan Smith <dylan.ah.sm...@gmail.com> wrote: > I thought a good test case for fish_indent was to try it on all the fish > functions (i.e. share/functions/*.fish). I used the following command: > >> for f in *.fish; diff "$f" (../../fish_indent < "$f" | psub); end | vim -R - > (Note: I used vim to show whitespace and for syntax highlighting) > > Here are my observations: > > In __fish_complete_ls.fish I found that "and" commands get split onto the > next line: > - command ls --version >/dev/null ^/dev/null; and set is_gnu --is-gnu > + command ls --version > /dev/null ^ /dev/null > + and set is_gnu --is-gnu > A good heuristically for fish_indent would be to keep the "and" and "or" > commands on the same line. Perhaps this will cause long lines in some > cases, but if the "and" command gets split onto another line then perhaps > it should be indented.
Absolutely not! "and", "or" and "not" should go on separate lines. It is easier to read code that has smaller chunks of code per line. The traditional shell script mindset runs counter to that, but if you change the mindset, it's all good. Fish is about doing the right thing even if it means breaking with convention. Also, they are separate commands, so there should be no exceptions for them compared to other commands. That is the Law of Minimalism. > Above you might also have noticed ^/dev/null get a space added between the > redirection symbol and the filename. This frequently occurs, because it > seems as if it is more common to omit the space, so should fish_indent be > changed to omit this space? No. It is easier to read code that has tokens separated by spaces. You can certainly find shell script code that omits the spaces before or after the redirection symbols, but I think that's just sloppiness and poor style; there is no good reason for it. [...] Philip ------------------------------------------------------------------------------ What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users