Add rm utility and improve further

This commit is contained in:
joachimschmidt557 2019-03-27 11:49:48 +01:00
parent 761eb0a5e6
commit 20f776b4bd
4 changed files with 36 additions and 7 deletions

16
rm.nim Normal file
View file

@ -0,0 +1,16 @@
import cligen, os
import common
proc main(files:seq[string], force=false, recursive=false) =
for file in files:
if existsFile(file):
removeFile(file)
elif existsDir(file):
if recursive:
removeDir(file)
else:
echo "rm: cannot remove '" & file & "': Is a directory"
else:
echo "rm: cannot remove '" & file & "': No such file or directory"
dispatch(main, version=("version", nimbaseVersion))