code / nomsu

Lines6.6K Lua5.1K PEG1.3K make117
2 others 83
Markdown60 Bourne Again Shell23
(38 lines)
1 #!/usr/bin/env nomsu -V7.0.0
2 ###
3 A tool to uninstall third party Nomsu packages (the inverse of the install tool)
5 Usage:
6 nomsu -t uninstall <package_names...>
8 use "filesystem"
9 use "commandline"
10 use "shell"
12 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 (run command $cmd) means:
15 say $cmd
16 try:
17 sh> $cmd
18 ..if it fails:
19 say ("
20 Sorry, the uninstall failed. You may need to re-run as root with `sudo` in front of the command.
21 ")
22 exit 1
24 command line program with $args:
25 $searchpath =
26 [:
27 for $ in ["?.lua", "?/init.lua", "?.nom", "?/init.nom"]:
28 add "\$(NOMSU PACKAGEPATH)\$"
29 ], joined with ";"
31 for $package_name in $args.extras:
32 $path = ($package.searchpath $package_name $package.nomsupath "/")
33 unless $path:
34 say "Sorry, couldn't find \$package_name in \$(NOMSU PACKAGEPATH)"
35 exit 1
36 $path = ($path, with "/init%.nom" -> "")
37 unless ((ask "Do you want to delete \($path)? [Y/n] ") == "n"):
38 run command "rm -rv \$path"