diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2022-10-10 15:01:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-10 15:01:39 +0200 |
commit | b8def035755042a224b46be5b468d81c82ae2039 (patch) | |
tree | 6ca549ece931ea35b319618a1e3ca3e4630efbf6 /tools/atlas | |
parent | db3d2971cf048b92c6a8420153da62f7bb907b21 (diff) | |
download | Nim-b8def035755042a224b46be5b468d81c82ae2039.tar.gz |
Atlas: added an explicit --workspace option (#20532)
Diffstat (limited to 'tools/atlas')
-rw-r--r-- | tools/atlas/atlas.nim | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/atlas/atlas.nim b/tools/atlas/atlas.nim index 2a2cf6454..274e94517 100644 --- a/tools/atlas/atlas.nim +++ b/tools/atlas/atlas.nim @@ -30,6 +30,7 @@ Options: --keepCommits do not perform any `git checkouts` --cfgHere also create/maintain a nim.cfg in the current working directory + --workspace=DIR use DIR as workspace --version show the version --help show this help """ @@ -460,7 +461,7 @@ proc main = var c = AtlasContext( projectDir: getCurrentDir(), - workspace: getCurrentDir()) + workspace: "") for kind, key, val in getopt(): case kind @@ -474,12 +475,23 @@ proc main = of "help", "h": writeHelp() of "version", "v": writeVersion() of "keepcommits": c.keepCommits = true + of "workspace": + if val.len > 0: + c.workspace = val + createDir(val) + else: + writeHelp() of "cfghere": c.cfgHere = true else: writeHelp() of cmdEnd: assert false, "cannot happen" - while c.workspace.len > 0 and dirExists(c.workspace / ".git"): - c.workspace = c.workspace.parentDir() + if c.workspace.len > 0: + if not dirExists(c.workspace): error "Workspace directory '" & c.workspace & "' not found." + else: + c.workspace = getCurrentDir() + while c.workspace.len > 0 and dirExists(c.workspace / ".git"): + c.workspace = c.workspace.parentDir() + echo "Using workspace ", c.workspace case action of "": |