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) =
511511 writeFiles ()
512512 echo " "
513513
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 ) =
515521 # # Command-line utility for Tangling of Org mode documents
522+ if version:
523+ echoVersion ()
524+ quit QuitSuccess
525+
516526 startTime = cpuTime ()
517527 try :
518528 for f1 in orgFilesOrDirs:
@@ -532,18 +542,19 @@ proc ntangle(orgFilesOrDirs: seq[string]) =
532542 except :
533543 stderr.styledWriteLine (fgRed, fmt" [ERROR] { getCurrentException ().name} : " ,
534544 fgDefault, getCurrentExceptionMsg () & " \n " )
535- quit 1
545+ quit QuitFailure
536546
537547when isMainModule :
538548 import cligen
539549 const
540550 url = " https://github.com/OrgTangle/ntangle"
541551 dispatchGen (ntangle
542- , usage= " \n NAME\n ntangle - $doc\n " &
552+ , usage = " \n NAME\n ntangle - $doc\n " &
543553 " USAGE\n $command $args\n\n " &
544554 " OPTIONS\n $options\n " &
545555 " URL\n " & url & " \n "
546- , version = (" version" , " 0.6.1" ))
556+ , help = { " version" : " write the version to stdout" }
557+ )
547558 if paramCount ()== 0 :
548559 quit (dispatch_ntangle (@ [" --help" ]))
549560 else :
You can’t perform that action at this time.
0 commit comments