Change CLI to allow the config file to be specified as an option.

This commit is contained in:
Jonathan Bernard 2017-04-23 00:16:40 -05:00
parent 52b7d2f48b
commit 06b8914e7b

View File

@ -14,21 +14,17 @@ proc logProcOutput*(outMsg, errMsg: TaintedString, cmd: string) =
when isMainModule:
var cfg = loadStrawBossConfig("strawboss.config.json")
if not existsDir(cfg.artifactsRepo):
echo "Artifacts repo (" & cfg.artifactsRepo & ") does not exist. Creating..."
createDir(cfg.artifactsRepo)
cfg.artifactsRepo = expandFilename(cfg.artifactsRepo)
let doc = """
Usage:
strawboss serve
strawboss serve [options]
strawboss run <project> <step> [options]
strawboss hashpwd <pwd>
Options
-c --config-file <cfgFile> Use this config file instead of the default
(strawboss.config.json).
-f --force-rebuild Force a build step to re-run even we have cached
results from building that step before for this
version of the project.
@ -41,6 +37,17 @@ Options
let args = docopt(doc, version = "strawboss v" & SB_VER)
let cfgFile = if args["--config-file"]: $args["--config-file"]
else: "strawboss.config.json"
var cfg = loadStrawBossConfig(cfgFile)
if not existsDir(cfg.artifactsRepo):
echo "Artifacts repo (" & cfg.artifactsRepo & ") does not exist. Creating..."
createDir(cfg.artifactsRepo)
cfg.artifactsRepo = expandFilename(cfg.artifactsRepo)
if args["run"]:
let req = RunRequest(