Allow exiting shell with 'exit'.
This commit is contained in:
parent
2059fd52c9
commit
11fde7126d
@ -1,4 +1,6 @@
|
||||
import cliutils, docopt, linenoise, os, osproc, sequtils, strutils
|
||||
import cliutils, cstrutils, docopt, linenoise, os, osproc, sequtils, strutils
|
||||
|
||||
import "./version.nim"
|
||||
|
||||
proc writeOutput(msg, errMsg: TaintedString, cmd: string): void =
|
||||
if not msg.isEmptyOrWhitespace: stdout.writeLine(msg)
|
||||
@ -11,7 +13,7 @@ Usage:
|
||||
cmd_shell [--prepend-args] <cmd> [-- <args>...]
|
||||
"""
|
||||
# Parse arguments
|
||||
let args = docopt(usage, version = "1.1.0")
|
||||
let args = docopt(usage, version = CMD_SHELL_VERSION)
|
||||
|
||||
let cmdPrompt = $args["<cmd>"]
|
||||
let cmd = '"' & cmdPrompt & '"'
|
||||
@ -26,7 +28,7 @@ Usage:
|
||||
|
||||
var line = readLine(cmdPrompt & "> ")
|
||||
|
||||
while line != nil:
|
||||
while line != nil and cmpIgnoreCase(line, "exit") != 0:
|
||||
if args["--prepend-args"]:
|
||||
discard exec(cmd & " " & argsForCmd & " " & $line, "", [], nil, {poUsePath, poEvalCommand}, writeOutput)
|
||||
else:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Wrapper around CLI commands (passing input as arguments)."
|
||||
license = "MIT"
|
||||
@ -8,4 +8,12 @@ bin = @["cmd_shell"]
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires @["nim >= 0.16.1", "cliutils"]
|
||||
requires @[
|
||||
"nim >= 0.16.1",
|
||||
"cliutils",
|
||||
|
||||
"https://git.jdb-labs.com/jdb/update-nim-package-version"
|
||||
]
|
||||
|
||||
task updateVersion, "Update the version of this package.":
|
||||
exec "update_nim_package_version cmd_shell 'version.nim'"
|
1
version.nim
Normal file
1
version.nim
Normal file
@ -0,0 +1 @@
|
||||
const CMD_SHELL_VERSION* = "1.2.0"
|
Loading…
x
Reference in New Issue
Block a user