The edit command can now be called non-interactively to set properties/tags.
This commit is contained in:
25
src/pit.nim
25
src/pit.nim
@@ -253,11 +253,6 @@ when isMainModule:
|
||||
elif args["edit"]:
|
||||
for editRef in @(args["<ref>"]):
|
||||
|
||||
let propsOption =
|
||||
if args["--properties"]:
|
||||
some(parsePropertiesOption($args["--properties"]))
|
||||
else: none(TableRef[string, string])
|
||||
|
||||
var stateOption = none(IssueState)
|
||||
|
||||
try: stateOption = some(parseEnum[IssueState](editRef))
|
||||
@@ -267,10 +262,16 @@ when isMainModule:
|
||||
let state = stateOption.get
|
||||
ctx.loadIssues(state)
|
||||
for issue in ctx.issues[state]:
|
||||
if propsOption.isSome:
|
||||
for k,v in propsOption.get:
|
||||
if propertiesOption.isSome:
|
||||
for k,v in propertiesOption.get:
|
||||
issue[k] = v
|
||||
edit(issue)
|
||||
if tagsOption.isSome:
|
||||
issue.tags = deduplicate(issue.tags & tagsOption.get)
|
||||
if exclTagsOption.isSome:
|
||||
issue.tags = issue.tags.filter(
|
||||
proc (tag: string): bool = not exclTagsOption.get.anyIt(it == tag))
|
||||
if args["--non-interactive"]: issue.store()
|
||||
else: edit(issue)
|
||||
updatedIssues.add(issue)
|
||||
|
||||
else:
|
||||
@@ -278,7 +279,13 @@ when isMainModule:
|
||||
if propertiesOption.isSome:
|
||||
for k,v in propertiesOption.get:
|
||||
issue[k] = v
|
||||
edit(issue)
|
||||
if tagsOption.isSome:
|
||||
issue.tags = deduplicate(issue.tags & tagsOption.get)
|
||||
if exclTagsOption.isSome:
|
||||
issue.tags = issue.tags.filter(
|
||||
proc (tag: string): bool = not exclTagsOption.get.anyIt(it == tag))
|
||||
if args["--non-interactive"]: issue.store()
|
||||
else: edit(issue)
|
||||
updatedIssues.add(issue)
|
||||
|
||||
elif args["tag"]:
|
||||
|
||||
Reference in New Issue
Block a user