Add rm utility and improve further
This commit is contained in:
parent
761eb0a5e6
commit
20f776b4bd
4 changed files with 36 additions and 7 deletions
16
rm.nim
Normal file
16
rm.nim
Normal 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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue