aboutsummaryrefslogtreecommitdiff
path: root/tools/upgrade.nom
blob: 14f7ee02317b31ed2997319b9d352737062fe531 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env Nomsu -V2.3.4.3
use "core"
use "compatibility"
use "lib/os.nom"

%args = (command line args)
%inplace = (no)
if (%args.1 is "-i"):
    %inplace = (yes)
    remove index 1 from %args
for %path in %args:
    if (%path is "-i"): %inplace = (yes)
    for file %filename in %path:
        %tree = (parse (read file %filename) from %filename)
        %tree = (%tree upgraded from %tree.version to (Nomsu version))
        %text = "#!/usr/bin/env nomsu -V\(Nomsu version)\n\(%tree as nomsu)"
        if %inplace:
            write %text to file %filename
        ..else:
            say %text