File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -511,8 +511,18 @@ proc doOrgTangle(file: string) =
511
511
writeFiles ()
512
512
echo " "
513
513
514
- proc ntangle (orgFilesOrDirs: seq [string ]) =
514
+ proc echoVersion () =
515
+ # # Echo the version string.
516
+ const
517
+ versionString = staticExec (" git describe --tags HEAD" )
518
+ echo fmt" ntangle { version_string} "
519
+
520
+ proc ntangle (orgFilesOrDirs: seq [string ], version = false ) =
515
521
# # Command-line utility for Tangling of Org mode documents
522
+ if version:
523
+ echoVersion ()
524
+ quit QuitSuccess
525
+
516
526
startTime = cpuTime ()
517
527
try :
518
528
for f1 in orgFilesOrDirs:
@@ -532,18 +542,19 @@ proc ntangle(orgFilesOrDirs: seq[string]) =
532
542
except :
533
543
stderr.styledWriteLine (fgRed, fmt" [ERROR] { getCurrentException ().name} : " ,
534
544
fgDefault, getCurrentExceptionMsg () & " \n " )
535
- quit 1
545
+ quit QuitFailure
536
546
537
547
when isMainModule :
538
548
import cligen
539
549
const
540
550
url = " https://github.com/OrgTangle/ntangle"
541
551
dispatchGen (ntangle
542
- , usage= " \n NAME\n ntangle - $doc\n " &
552
+ , usage = " \n NAME\n ntangle - $doc\n " &
543
553
" USAGE\n $command $args\n\n " &
544
554
" OPTIONS\n $options\n " &
545
555
" URL\n " & url & " \n "
546
- , version = (" version" , " 0.6.1" ))
556
+ , help = { " version" : " write the version to stdout" }
557
+ )
547
558
if paramCount ()== 0 :
548
559
quit (dispatch_ntangle (@ [" --help" ]))
549
560
else :
You can’t perform that action at this time.
0 commit comments