Skip to content

Commit 3543e71

Browse files
committed
improved CLI
1 parent 6e725ac commit 3543e71

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

pipelines/pipelines.nim

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ proc runFile*(path: string) =
311311

312312
# add directory containing .pipeline file to PYTHONPATH
313313
when defined windows:
314-
syssetpath($(getPath()) & ";" & path[0 .. path.rfind("/")])
314+
syssetpath($getPath() & ";" & path[0 .. path.rfind("/")])
315315
else:
316-
syssetpath($(getPath()) & ":" & path[0 .. path.rfind("/")])
316+
syssetpath($getPath() & ":" & path[0 .. path.rfind("/")])
317317

318318
# run code
319319
discard runSimpleString(code)
@@ -352,15 +352,25 @@ proc main() =
352352
# get path to file to run
353353
let path: string = paramStr(1)
354354

355+
# files compiled
356+
var filesCompiled: seq[string] = @[]
357+
355358
# run file
356359
if fileExists(path):
357360
compileFile(path)
361+
filesCompiled.add(path)
358362
elif dirExists(path):
359363
for kind, file in walkDir(path):
360-
if file.endsWith(".pipleine"):
364+
if file.endsWith(".pipeline"):
361365
compileFile(file)
366+
filesCompiled.add(file)
362367
else:
363368
echo(path & " not found")
369+
370+
# print info
371+
echo($filesCompiled.len & " " & (if filesCompiled.len == 1: "file" else: "files") & " compiled" & (if dirExists(path): " at " & path else: "") & ":")
372+
for file in filesCompiled:
373+
echo(" " & file)
364374
of 2:
365375
case paramStr(1):
366376
of "r", "run":
@@ -380,6 +390,9 @@ proc main() =
380390
# get path to folder to clean
381391
let path: string = paramStr(2)
382392

393+
# number of files removed
394+
var filesRemoved: seq[string] = @[]
395+
383396
# clean folder
384397
for kind, file in walkDir(path):
385398
# compiled .py file
@@ -388,6 +401,12 @@ proc main() =
388401
# remove compiled file if it exists
389402
if compiledFile != "":
390403
removeFile(compiledFile)
404+
filesRemoved.add(compiledFile)
405+
406+
# print info
407+
echo($filesRemoved.len & " " & (if filesRemoved.len == 1: "file" else: "files") & " removed from " & path & ":")
408+
for file in filesRemoved:
409+
echo(" " & file)
391410
else:
392411
discard
393412

0 commit comments

Comments
 (0)