aboutsummaryrefslogtreecommitdiff
path: root/tools/upgrade.nom
diff options
context:
space:
mode:
Diffstat (limited to 'tools/upgrade.nom')
-rwxr-xr-xtools/upgrade.nom14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/upgrade.nom b/tools/upgrade.nom
index 7d36793..575646e 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -1,7 +1,7 @@
#!/usr/bin/env nomsu -V4.8.10
#
Tool to automatically update code from old versions of Nomsu. Usage:
- nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...
+ nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...
If "-i" is the first argument, upgrades will be performed in-place. Otherwise, the
upgraded code will be printed.
@@ -10,27 +10,37 @@ use "lib/os.nom"
%args = (command line args)
%inplace = (no)
+%start_version = (nil)
%version = (Nomsu version)
repeat:
if %args.1 is:
"-i":
%inplace = (yes)
%args::remove index 1
+
"-t":
use "lib/consolecolor.nom"
%test = (yes)
%args::remove index 1
+
"-V":
%version = %args.2
%args::remove index 1
%args::remove index 1
+
+ "-S":
+ %start_version = %args.2
+ %args::remove index 1
+ %args::remove index 1
+
else: stop
for %path in %args:
for file %filename in %path:
unless (%filename::matches "%.nom$"): do next %filename
%tree = (parse (read file %filename) from %filename)
- %uptree = (%tree upgraded to %version)
+ %uptree = (..)
+ %tree upgraded from (%start_version or (%tree.version or (Nomsu version))) to %version
%text = "\
..#!/usr/bin/env nomsu -V\%version
\(%uptree as nomsu)"