From 6edf6a275574cf8c3cb6a7015e22d0c982e2e489 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 31 Dec 2018 01:37:24 -0800 Subject: Overhaul of command line argument parsing. Now supports "-abc" as 3 flags, and stores them as .a, .b, .c instead of ."-a", etc. (same for --args) --- tools/format.nom | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools/format.nom') diff --git a/tools/format.nom b/tools/format.nom index 65cc2ca..df89635 100755 --- a/tools/format.nom +++ b/tools/format.nom @@ -4,6 +4,7 @@ nomsu -t format [-i] file1 file2... If the "-i" flag is used, the file will be edited in-place. + If the "-q" flag is used and an error occurs, the original file will be printed. If no files are passed in, this will read from stdin. use "lib/os.nom" @@ -26,7 +27,7 @@ for $filename in $filenames: try: $tree = ($code parsed) ..and if it barfs $msg: - if $(COMMAND LINE ARGS)."-q": + if $(COMMAND LINE ARGS).q: $formatted = $file ..else: say $msg @@ -36,7 +37,7 @@ for $filename in $filenames: "\$leading_indent\($tree as nomsu, text, with "\n" -> "\n\$leading_indent")" if $formatted: - if $(COMMAND LINE ARGS)."-i": + if $(COMMAND LINE ARGS).i: write $formatted to file $filename ..else: say $formatted inline -- cgit v1.2.3