From 06b8914e7b03775668536e858010599736207cae Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sun, 23 Apr 2017 00:16:40 -0500 Subject: [PATCH] Change CLI to allow the config file to be specified as an option. --- src/main/nim/strawboss.nim | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/nim/strawboss.nim b/src/main/nim/strawboss.nim index 44908ee..6e8c997 100644 --- a/src/main/nim/strawboss.nim +++ b/src/main/nim/strawboss.nim @@ -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 [options] strawboss hashpwd Options + -c --config-file 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(