diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-12-14 20:21:03 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-12-14 20:21:03 -0800 |
| commit | 4fe63f253f58f87ab986fea38902d95f2a5ea338 (patch) | |
| tree | 12094f1c69b8ab375eb17507c959c43f9295c6c2 /tools/upgrade.nom | |
| parent | 6abec65843f0f37f7fc6032ac5db0fff3db71815 (diff) | |
Auto-updated to version 5
Diffstat (limited to 'tools/upgrade.nom')
| -rwxr-xr-x | tools/upgrade.nom | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tools/upgrade.nom b/tools/upgrade.nom index 0512134..48f1811 100755 --- a/tools/upgrade.nom +++ b/tools/upgrade.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.12.12.8 +#!/usr/bin/env nomsu -V5.12.12.8 # Tool to automatically update code from old versions of Nomsu. Usage: nomsu tools/upgrade.nom [-i] file1 file2 directory1 ... @@ -11,32 +11,32 @@ use "lib/consolecolor.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -%args = (command line args) -%inplace = (%args."-i" or %args."--inplace") -%start_version = %args."--upgrade-from" -%version = (%args."--upgrade-to" or (Nomsu version)) -%test = (%args."-t" or %args."--test") -for %filename in %args.extra_args: - %file = (read file %filename) - unless %file: - barf "File does not exist: \%filename" - %leading_indent = (%file::matching "[\n]*([ ]*)") - %code = (NomsuCode from (Source %filename 1 (size of %file)) %file) - %tree = (%code parsed) - %uptree = (..) - %tree upgraded from (%start_version or (%tree.version or (Nomsu version))) to \ - ..%version - %text = "\%leading_indent\(((%uptree as nomsu)::text)::with "\n" -> "\n\%leading_indent")" +$args = (command line args) +$inplace = ($args."-i" or $args."--inplace") +$start_version = $args."--upgrade-from" +$version = ($args."--upgrade-to" or (Nomsu version)) +$test = ($args."-t" or $args."--test") +for $filename in $args.extra_args: + $file = (read file $filename) + unless $file: + barf "File does not exist: \$filename" + $leading_indent = ($file|matching "[\n]*([ ]*)") + $code = (NomsuCode from (Source $filename 1 (size of $file)) $file) + $tree = ($code parsed) + $uptree = (..) + $tree upgraded from ($start_version or ($tree.version or (Nomsu version))) to \ + ..$version + $text = "\$leading_indent\((($uptree as nomsu)|text)|with "\n" -> "\n\$leading_indent")" when: - %inplace: - say "Upgraded \%filename" - write %text to file %filename + $inplace: + say "Upgraded \$filename" + write $text to file $filename - %test: - if (%uptree == %tree): - say (dim "\%filename will not be changed") + $test: + if ($uptree == $tree): + say (dim "\$filename will not be changed") ..else: - say (bright "\%filename will be changed") + say (bright "\$filename will be changed") else: - say %text inline + say $text inline |
