diff --git a/compatibility/3.5.5.6.nom b/compatibility/3.5.5.6.nom index de6cc1f..c428b0d 100644 --- a/compatibility/3.5.5.6.nom +++ b/compatibility/3.5.5.6.nom @@ -7,7 +7,5 @@ use "compatibility/compatibility.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ upgrade action "traceback" to "3.5.5.6" via (..) - -> (barf "'traceback' has been deprecated") - -upgrade action "traceback 1" to "3.5.5.6" via (..) - -> (barf "'traceback 1' has been deprecated") + for %tree: + compile error at %tree "'traceback' has been deprecated." diff --git a/compatibility/3.nom b/compatibility/3.nom index a1ce99b..87f5c0c 100644 --- a/compatibility/3.nom +++ b/compatibility/3.nom @@ -10,4 +10,6 @@ upgrade action (method %spec %body) to "3" as (my action %spec %body) upgrade action (me) to "3" as %me upgrade action (@) to "3" as %me upgrade action "as" to "3" via (..) - -> (barf "Object API has changed. Use (%obj::action ...) instead of (as %obj: action ...)") + for %tree: + compile error at %tree "Object API has changed and 'as' is no longer supported." "\ + ..Use (%obj::action ...) instead of (as %obj: action ...)" diff --git a/compatibility/4.11.nom b/compatibility/4.11.nom index 042da1e..8021be3 100644 --- a/compatibility/4.11.nom +++ b/compatibility/4.11.nom @@ -27,6 +27,11 @@ upgrade action "set" to "4.11" via (..) %rhs.%i = %entry.2 return (SyntaxTree {type: "Action", source: %tree.source, 1: %lhs, 2: "=", 3: %rhs}) +upgrade action "1 with 2 ~>" to "4.11" via (..) + for %tree: + compile error at %tree "This method has been deprecated." "\ + ..Perhaps this could be use %tree::map instead." + # Changing filesystem API: upgrade action (for file %f in %path %body) to "4.11" as (..) for %f in (files for %path) %body diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom index 5be8eeb..4d96d89 100644 --- a/compatibility/compatibility.nom +++ b/compatibility/compatibility.nom @@ -92,7 +92,11 @@ externally [..] add %k = (%v upgraded from %start_version to %end_version) set %with_upgraded_args's metatable to (%tree's metatable) %tree = (%UPGRADES.%ver %with_upgraded_args %end_version) - %tree.shebang = "#!/usr/bin/env nomsu -V\%end_version\n" + if (%tree.version != %end_version): + %tree = (SyntaxTree {: for %k = %v in %tree: add %k = %v}) + %tree.version = %end_version + if %tree.shebang: + %tree.shebang = "#!/usr/bin/env nomsu -V\%end_version\n" return %tree externally (%tree upgraded from %start_version) means (..) diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index c89b1df..67219ac 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -338,21 +338,6 @@ externally (match %tree with %patt) means: end return matches" -externally (%tree with %patt ~> %replacement) means: - lua> "\ - ..return \%tree:map(function(\%t) - local \%vars = \(match %t with %patt) - if not \%vars then return nil end - for \%k,\%v in pairs(\%vars) do - \%vars[\%k] = \(%v with %patt ~> %replacement) - end - return \%replacement:map(function(\%t) - if \%t.type == "Var" then - return \%vars[\%t[1]] - end - end) - end)" - test: assume ((quote "one\n\"two\"") == "\"one\\n\\\"two\\\"\"") diff --git a/files.lua b/files.lua index abc9d95..72ec63b 100644 --- a/files.lua +++ b/files.lua @@ -37,12 +37,13 @@ Files.read = function(filename) do local file_contents = _FILE_CACHE[filename] if file_contents then - return file_contents + return file_contents or nil end end - if filename == 'stdin' then + if filename == 'stdin' or filename == '-' then local contents = io.read('*a') Files.spoof('stdin', contents) + Files.spoof('-', contents) return contents end local file = io.open(filename) @@ -52,7 +53,7 @@ Files.read = function(filename) local contents = file:read("*a") file:close() _FILE_CACHE[filename] = contents - return contents + return contents or nil end local match, gsub do @@ -71,7 +72,7 @@ Files.exists = function(path) if _SPOOFED_FILES[path] then return true end - if path == 'stdin' then + if path == 'stdin' or path == '-' then return true end if run_cmd("ls " .. tostring(sanitize(path))) then @@ -82,7 +83,7 @@ end Files.list = function(path) if not (_BROWSE_CACHE[path]) then local files - if _SPOOFED_FILES[path] or path == 'stdin' then + if _SPOOFED_FILES[path] or path == 'stdin' or path == '-' then _BROWSE_CACHE[path] = { path } @@ -107,14 +108,14 @@ if ok then if _SPOOFED_FILES[path] then return true end - if path == 'stdin' or raw_file_exists(path) then + if path == 'stdin' or path == '-' or raw_file_exists(path) then return true end return false end Files.list = function(path) if not (_BROWSE_CACHE[path]) then - if _SPOOFED_FILES[path] or path == 'stdin' then + if _SPOOFED_FILES[path] or path == 'stdin' or path == '-' then _BROWSE_CACHE[path] = { path } diff --git a/files.moon b/files.moon index 93a7342..4088980 100644 --- a/files.moon +++ b/files.moon @@ -25,17 +25,18 @@ Files.spoof = (filename, contents)-> -- Read a file's contents Files.read = (filename)-> if file_contents = _FILE_CACHE[filename] - return file_contents - if filename == 'stdin' + return file_contents or nil + if filename == 'stdin' or filename == '-' contents = io.read('*a') Files.spoof('stdin', contents) + Files.spoof('-', contents) return contents file = io.open(filename) return nil unless file contents = file\read("*a") file\close! _FILE_CACHE[filename] = contents - return contents + return contents or nil {:match, :gsub} = string @@ -49,14 +50,14 @@ sanitize = (path)-> Files.exists = (path)-> return true if _SPOOFED_FILES[path] - return true if path == 'stdin' + return true if path == 'stdin' or path == '-' return true if run_cmd("ls #{sanitize(path)}") return false Files.list = (path)-> unless _BROWSE_CACHE[path] local files - _BROWSE_CACHE[path] = if _SPOOFED_FILES[path] or path == 'stdin' + _BROWSE_CACHE[path] = if _SPOOFED_FILES[path] or path == 'stdin' or path == '-' {path} else run_cmd('find -L "'..path..'" -not -path "*/\\.*" -type f') or false return _BROWSE_CACHE[path] @@ -68,12 +69,12 @@ if ok return if mode == 'file' or mode == 'directory' or mode == 'link' then true else false Files.exists = (path)-> return true if _SPOOFED_FILES[path] - return true if path == 'stdin' or raw_file_exists(path) + return true if path == 'stdin' or path == '-' or raw_file_exists(path) return false Files.list = (path)-> unless _BROWSE_CACHE[path] - _BROWSE_CACHE[path] = if _SPOOFED_FILES[path] or path == 'stdin' + _BROWSE_CACHE[path] = if _SPOOFED_FILES[path] or path == 'stdin' or path == '-' {path} else file_type, err = lfs.attributes(path, 'mode') diff --git a/nomsu.lua b/nomsu.lua index 415be51..08ab170 100644 --- a/nomsu.lua +++ b/nomsu.lua @@ -102,7 +102,7 @@ end local file_queue = List({ }) local sep = "\3" local parser = re.compile([[ args <- {| (flag %sep)* (({~ file ~} -> add_file) {:primary_file: %true :} %sep)? - {:nomsu_args: {| ({(!%sep .)*} %sep)* |} :} %sep? |} !. + {:nomsu_args: {| (nomsu_flag %sep)* {:extra_args: {| ({[^%sep]+} %sep)* |} :} |} :} |} !. flag <- {:optimization: "-O" (%sep? %number)? :} / ("-I" %sep? ({~ file ~} -> add_file)) @@ -115,6 +115,7 @@ local parser = re.compile([[ args <- {| (flag %sep)* (({~ file ~} -> add_file / {:no_core: "--no-core" %true :} / {:debugger: ("-d" %sep? {(!%sep .)*}) :} / {:requested_version: "-V" (%sep? {([0-9.])+})? :} + nomsu_flag <- {| ({:key: ('-' [a-z]) :} {:value: %true :}) / ({:key: ('--' [^%sep=]+) :} {:value: ('=' {[^%sep]+}) / %true :}) |} file <- ("-" -> "stdin") / {(!%sep .)+} ]], { ["true"] = lpeg.Cc(true), @@ -135,7 +136,14 @@ if not args or args.help then print(usage) os.exit(EXIT_FAILURE) end -nomsu_environment.command_line_args = List(args.nomsu_args) +local nomsu_args = Dict({ }) +local _list_0 = args.nomsu_args +for _index_0 = 1, #_list_0 do + local argpair = _list_0[_index_0] + nomsu_args[argpair.key] = argpair.value +end +nomsu_args.extra_args = List(args.nomsu_args.extra_args or { }) +nomsu_environment.command_line_args = nomsu_args nomsu_environment.OPTIMIZATION = tonumber(args.optimization or 1) if args.version then nomsu_environment.run_file_1_in('core', nomsu_environment, nomsu_environment.OPTIMIZATION) @@ -146,26 +154,14 @@ local run run = function() local input_files = { } for _index_0 = 1, #file_queue do - local _continue_0 = false - repeat - local f = file_queue[_index_0] - if f == 'stdin' then - input_files[f] = true - _continue_0 = true - break - end - if not (Files.exists(f)) then - error("Could not find: '" .. tostring(f) .. "'") - end - local _list_0 = Files.list(f) - for _index_1 = 1, #_list_0 do - local filename = _list_0[_index_1] - input_files[filename] = true - end - _continue_0 = true - until true - if not _continue_0 then - break + local f = file_queue[_index_0] + if not (Files.exists(f)) then + error("Could not find: '" .. tostring(f) .. "'") + end + local _list_1 = Files.list(f) + for _index_1 = 1, #_list_1 do + local filename = _list_1[_index_1] + input_files[filename] = true end end if not (args.no_core) then diff --git a/nomsu.moon b/nomsu.moon index aaa3dfb..fd4e727 100755 --- a/nomsu.moon +++ b/nomsu.moon @@ -61,7 +61,7 @@ file_queue = List{} sep = "\3" parser = re.compile([[ args <- {| (flag %sep)* (({~ file ~} -> add_file) {:primary_file: %true :} %sep)? - {:nomsu_args: {| ({(!%sep .)*} %sep)* |} :} %sep? |} !. + {:nomsu_args: {| (nomsu_flag %sep)* {:extra_args: {| ({[^%sep]+} %sep)* |} :} |} :} |} !. flag <- {:optimization: "-O" (%sep? %number)? :} / ("-I" %sep? ({~ file ~} -> add_file)) @@ -74,6 +74,7 @@ parser = re.compile([[ / {:no_core: "--no-core" %true :} / {:debugger: ("-d" %sep? {(!%sep .)*}) :} / {:requested_version: "-V" (%sep? {([0-9.])+})? :} + nomsu_flag <- {| ({:key: ('-' [a-z]) :} {:value: %true :}) / ({:key: ('--' [^%sep=]+) :} {:value: ('=' {[^%sep]+}) / %true :}) |} file <- ("-" -> "stdin") / {(!%sep .)+} ]], { true:lpeg.Cc(true), number:lpeg.R("09")^1/tonumber, sep:lpeg.P(sep) @@ -88,7 +89,11 @@ args = parser\match(arg_string) if not args or args.help print usage os.exit(EXIT_FAILURE) -nomsu_environment.command_line_args = List(args.nomsu_args) +nomsu_args = Dict{} +for argpair in *args.nomsu_args + nomsu_args[argpair.key] = argpair.value +nomsu_args.extra_args = List(args.nomsu_args.extra_args or {}) +nomsu_environment.command_line_args = nomsu_args nomsu_environment.OPTIMIZATION = tonumber(args.optimization or 1) if args.version @@ -99,9 +104,6 @@ if args.version run = -> input_files = {} for f in *file_queue - if f == 'stdin' - input_files[f] = true - continue unless Files.exists(f) error("Could not find: '#{f}'") for filename in *Files.list(f) diff --git a/nomsu_environment.lua b/nomsu_environment.lua index 7b26852..6f46640 100644 --- a/nomsu_environment.lua +++ b/nomsu_environment.lua @@ -296,6 +296,7 @@ local nomsu_environment = Importer({ end _currently_running_files:add(path) local mod = _1_forked(environment) + local did_anything = false for nomsupath in package.nomsupath:gmatch("[^;]+") do local _continue_0 = false repeat @@ -323,6 +324,7 @@ local nomsu_environment = Importer({ code = NomsuCode:from(Source(filename, 1, #file), file) end environment.run_1_in(code, mod) + did_anything = true _continue_1 = true until true if not _continue_1 then @@ -337,6 +339,9 @@ local nomsu_environment = Importer({ break end end + if not (did_anything) then + error("File not found: " .. tostring(path), 0) + end import_to_1_from(environment, mod, prefix) environment.FILE_CACHE[path] = mod return _currently_running_files:remove() diff --git a/nomsu_environment.moon b/nomsu_environment.moon index 9dab5e9..00b8a3f 100644 --- a/nomsu_environment.moon +++ b/nomsu_environment.moon @@ -169,6 +169,7 @@ nomsu_environment = Importer{ _currently_running_files\add path mod = _1_forked(environment) + did_anything = false for nomsupath in package.nomsupath\gmatch("[^;]+") files = Files.list(nomsupath.."/"..path) continue unless files @@ -183,7 +184,10 @@ nomsu_environment = Importer{ file = Files.read(filename) NomsuCode\from(Source(filename, 1, #file), file) environment.run_1_in(code, mod) + did_anything = true break + unless did_anything + error("File not found: #{path}", 0) import_to_1_from(environment, mod, prefix) environment.FILE_CACHE[path] = mod _currently_running_files\remove! diff --git a/tools/autoformat.nom b/tools/autoformat.nom index 96b732b..5661145 100755 --- a/tools/autoformat.nom +++ b/tools/autoformat.nom @@ -10,23 +10,17 @@ use "lib/os.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %args = (command line args) -%inplace = (no) -if (%args.1 is "-i"): - %inplace = (yes) - %args::remove index 1 - -for %path in %args: - if (%path == "-"): - %path = "stdin" +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) + %formatted = "\ + ..\%leading_indent\(((%tree as nomsu)::text)::with "\n" -> "\n\%leading_indent")" - for %filename in (files for %path): - unless ((%filename::matches "%.nom$") or (%filename == "stdin")): - do next %filename - %contents = (read file %filename) - %code = (NomsuCode from (Source %filename 1 (size of %contents)) %contents) - %tree = (%code parsed) - %formatted = ((%tree as nomsu)::text) - if %inplace: - write %formatted to file %filename - ..else: - say %formatted inline + if %args."-i": + write %formatted to file %filename + ..else: + say %formatted inline diff --git a/tools/find_action.nom b/tools/find_action.nom index c6cbe36..6b85ad3 100755 --- a/tools/find_action.nom +++ b/tools/find_action.nom @@ -9,37 +9,33 @@ use "lib/consolecolor.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -%stub = (command line args).1 +%stub = (command line args).extra_args.1 say "Looking for stub: \%stub..." -for % in 2 to (size of (command line args)): - for %filename in (files for (command line args).%): - if (%filename == "-"): - %filename = "stdin" +for % in 2 to (size of (command line args).extra_args): + %filename = (command line args).extra_args.% + %file = (read file %filename) + unless %file: + barf "File does not exist: \%filename" + %code = (NomsuCode from (%Source %filename 1 (size of %file)) %file) + try: + %tree = (%code parsed) + ..and if it barfs %msg: + say (red "\%filename failed to parse:\n\%msg") + %tree = (nil) + + unless %tree: + do next %filename + + %results = [] + for %t in recursive %tree: + if ((%t is "Action" syntax tree) and (%t.stub is %stub)): + %line_num = (%file::line number at %t.source.start) + %results::add {..} + line: %line_num, text: "\(blue "\%filename:\%line_num:")\n\(yellow (source lines of %t))" - unless ((%filename == "stdin") or (%filename::matches "%.nom$")): - do next %filename - - %file = (read file %filename) - %code = (NomsuCode from (%Source %filename 1 (size of %file)) %file) - try: - %tree = (%code parsed) - ..and if it barfs %msg: - say (red "\%filename failed to parse:\n\%msg") - %tree = (nil) - - unless %tree: - do next %filename - - %results = [] - for %t in recursive %tree: - if ((%t is "Action" syntax tree) and (%t.stub is %stub)): - %line_num = (%file::line number at %t.source.start) - %results::add {..} - line: %line_num, text: "\(blue "\%filename:\%line_num:")\n\(yellow (source lines of %t))" - - if (%t is syntax tree): - for %sub in %t: - recurse %t on %sub - sort %results by % -> %.line - for % in %results: - say %.text + if (%t is syntax tree): + for %sub in %t: + recurse %t on %sub + sort %results by % -> %.line + for % in %results: + say %.text diff --git a/tools/parse.nom b/tools/parse.nom index 9e43c88..cb367ab 100755 --- a/tools/parse.nom +++ b/tools/parse.nom @@ -35,15 +35,10 @@ externally (print tree %t at indent %indent) means: else: say "\%indent \(quote %arg)" -for %path in (command line args): - for %filename in (files for %path): - if (%filename == "-"): - %filename = "stdin" - - unless ((%filename == "stdin") or (%filename::matches "%.nom$")): - do next %filename - - %text = (read file %filename) - %nomsu = (NomsuCode from (Source %filename 1 (size of %text)) %text) - %tree = (%nomsu parsed) - print tree %tree at indent "" +for %filename in (command line args).extra_args: + %file = (read file %filename) + unless %file: + barf "File does not exist: \%filename" + %nomsu = (NomsuCode from (Source %filename 1 (size of %file)) %file) + %tree = (%nomsu parsed) + print tree %tree at indent "" diff --git a/tools/replace.nom b/tools/replace.nom index 1ec8ecc..66ca690 100755 --- a/tools/replace.nom +++ b/tools/replace.nom @@ -9,36 +9,35 @@ use "lib/os.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -%args = (command line args) -%inplace = (no) -if (%args.1 is "-i"): - %inplace = (yes) - %args::remove index 1 +barf "Deprecated." -if ((size of %args) < 3): +if ((size of %args.extra_args) < 3): say "Usage: nomsu tools/replace.nom [-i] tree_to_replace replacement files..." lua> "os.exit(1)" -%pattern = (parse (%args::remove index 1)) -%replacement = (parse (%args::remove index 1)) -for %path in %args: - for %filename in (files for %path): - unless (any [%filename::matches "%.nom$", %filename == "-", %filename == "stdin"]): - do next %filename - %tree = (parse (read file %filename) from %filename) - %tree2 = (%tree with %pattern ~> %replacement) - if (%tree2 == %tree): - say "No changes in \%filename" - do next %filename +%pattern = ((%args.extra_args.1) parsed) +%replacement = ((%args.extra_args.2) parsed) +for %filename in %args.extra_args at %i: + if (%i < 3): do next %i + %file = (read file %filename) + unless %file: barf "File does not exist: \%filename" + %nomsu = (NomsuCode from (Source %filename 1 (size of %file)) %file) + %tree = (%nomsu parsed) + # TODO: fix this to use variable substitution + %tree2 = (..) + %tree::map (..) + for %subtree: + if (%subtree == %pattern): + return %replacement + if (%tree2 == %tree): + say "No changes in \%filename" + do next %filename + + %text = ((%tree2 as nomsu)::text) + when: + %args."-i": + say "Replaced in \%filename" + write %text to file %filename - %text = "\ - ..#!/usr/bin/env nomsu -V\(%tree.version or (Nomsu version)) - \(%tree2 as nomsu)" - - when: - %inplace: - say "Replaced in \%filename" - write %text to file %filename - - else: - say %text + else: + say %text diff --git a/tools/test.nom b/tools/test.nom index bdbec54..52e548f 100755 --- a/tools/test.nom +++ b/tools/test.nom @@ -8,24 +8,10 @@ use "lib/consolecolor.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -%args = (command line args) -if (%args.1 == "-v"): - %args::remove index 1 - %verbose = (yes) - -%to_run = [..] - : - for %path in (command line args): - for %filename in (files for %path): - if (%filename == "-"): - %filename = "stdin" - if ((%filename::matches "%.nom$") or (%filename == "stdin")): add %filename - # Make sure all the files get run -for %filename in %to_run: - use %filename +for %filename in (command line args).extra_args: use %filename %tests = {: for %s = %t in (tests): add (=lua "Source:from_string(\%s)") = %t} -for %filename in %to_run: +for %filename in (command line args).extra_args: %file_tests = [] for %src = %test in %tests: if (%src.filename == %filename): @@ -34,13 +20,13 @@ for %filename in %to_run: unless (%file_tests is empty): sort %file_tests by % -> %.source lua> "io.write('[ .. ] ', \%filename); io.flush()" - if %verbose: say "" + if (command line args)."-v": say "" for % in %file_tests: - if %verbose: + if (command line args)."-v": say " \(yellow (%.test::with "\n" -> "\n "))" run %.test - if %verbose: + if (command line args)."-v": say (green "PASS") ..else: say "\r[\(green "PASS")" diff --git a/tools/upgrade.nom b/tools/upgrade.nom index 56d67a5..781e71b 100755 --- a/tools/upgrade.nom +++ b/tools/upgrade.nom @@ -7,56 +7,36 @@ use "compatibility" use "lib/os.nom" +use "lib/consolecolor.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 +%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 - "-t": - use "lib/consolecolor.nom" - %test = (yes) - %args::remove index 1 + %test: + if (%uptree == %tree): + say (dim "\%filename will not be changed") + ..else: + say (bright "\%filename will be changed") - "-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 %filename in (files for %path): - unless (%filename::matches "%.nom$"): do next %filename - %file = (read file %filename) - %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 = ((%uptree as nomsu)::text) - when: - %inplace: - say "Upgraded \%filename" - write %text to file %filename - - %test: - if (%uptree == %tree): - say (dim "\%filename will not be changed") - ..else: - say (bright "\%filename will be changed") - - else: - say %text + else: + say %text inline