Atlas: added an explicit --workspace option (#20532)
This commit is contained in:
parent
db3d2971cf
commit
b8def03575
1 changed files with 15 additions and 3 deletions
|
|
@ -30,6 +30,7 @@ Options:
|
||||||
--keepCommits do not perform any `git checkouts`
|
--keepCommits do not perform any `git checkouts`
|
||||||
--cfgHere also create/maintain a nim.cfg in the current
|
--cfgHere also create/maintain a nim.cfg in the current
|
||||||
working directory
|
working directory
|
||||||
|
--workspace=DIR use DIR as workspace
|
||||||
--version show the version
|
--version show the version
|
||||||
--help show this help
|
--help show this help
|
||||||
"""
|
"""
|
||||||
|
|
@ -460,7 +461,7 @@ proc main =
|
||||||
|
|
||||||
var c = AtlasContext(
|
var c = AtlasContext(
|
||||||
projectDir: getCurrentDir(),
|
projectDir: getCurrentDir(),
|
||||||
workspace: getCurrentDir())
|
workspace: "")
|
||||||
|
|
||||||
for kind, key, val in getopt():
|
for kind, key, val in getopt():
|
||||||
case kind
|
case kind
|
||||||
|
|
@ -474,12 +475,23 @@ proc main =
|
||||||
of "help", "h": writeHelp()
|
of "help", "h": writeHelp()
|
||||||
of "version", "v": writeVersion()
|
of "version", "v": writeVersion()
|
||||||
of "keepcommits": c.keepCommits = true
|
of "keepcommits": c.keepCommits = true
|
||||||
|
of "workspace":
|
||||||
|
if val.len > 0:
|
||||||
|
c.workspace = val
|
||||||
|
createDir(val)
|
||||||
|
else:
|
||||||
|
writeHelp()
|
||||||
of "cfghere": c.cfgHere = true
|
of "cfghere": c.cfgHere = true
|
||||||
else: writeHelp()
|
else: writeHelp()
|
||||||
of cmdEnd: assert false, "cannot happen"
|
of cmdEnd: assert false, "cannot happen"
|
||||||
|
|
||||||
|
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"):
|
while c.workspace.len > 0 and dirExists(c.workspace / ".git"):
|
||||||
c.workspace = c.workspace.parentDir()
|
c.workspace = c.workspace.parentDir()
|
||||||
|
echo "Using workspace ", c.workspace
|
||||||
|
|
||||||
case action
|
case action
|
||||||
of "":
|
of "":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue