diff --git a/pit.nimble b/pit.nimble index efac798..0b0852c 100644 --- a/pit.nimble +++ b/pit.nimble @@ -1,6 +1,6 @@ # Package -version = "4.26.0" +version = "4.27.0" author = "Jonathan Bernard" description = "Personal issue tracker." license = "MIT" diff --git a/src/pit.nim b/src/pit.nim index ee232e5..1116f82 100644 --- a/src/pit.nim +++ b/src/pit.nim @@ -253,7 +253,8 @@ proc list( ctx: CliContext, filter: Option[IssueFilter], states: Option[seq[IssueState]], - showToday, showFuture, + showToday = false, + showFuture = false, showHidden = false, verbose: bool) = @@ -427,6 +428,11 @@ when isMainModule: elif args["edit"]: for editRef in @(args[""]): + let propsOption = + if args["--properties"]: + some(parsePropertiesOption($args["--properties"])) + else: none(TableRef[string, string]) + var stateOption = none(IssueState) try: stateOption = some(parseEnum[IssueState](editRef)) @@ -435,9 +441,18 @@ when isMainModule: if stateOption.isSome: let state = stateOption.get ctx.loadIssues(state) - for issue in ctx.issues[state]: edit(issue) + for issue in ctx.issues[state]: + if propsOption.isSome: + for k,v in propsOption.get: + issue[k] = v + edit(issue) - else: edit(ctx.cfg.tasksDir.loadIssueById(editRef)) + else: + let issue = ctx.cfg.tasksDir.loadIssueById(editRef) + if propertiesOption.isSome: + for k,v in propertiesOption.get: + issue[k] = v + edit(issue) elif args["tag"]: if tagsOption.isNone: raise newException(Exception, "no tags given") @@ -578,10 +593,12 @@ when isMainModule: filter.exclProperties.del("context") var listContexts = false + var listTags = false var statesOption = none(seq[IssueState]) var issueIdsOption = none(seq[string]) if args["contexts"]: listContexts = true + elif args["tags"]: listTags = true elif args[""]: try: statesOption = @@ -607,6 +624,21 @@ when isMainModule: for c in uniqContexts.sorted: stdout.writeLine(c.alignLeft(maxLen+2) & ctx.getIssueContextDisplayName(c)) + elif listTags: + var uniqTags = newseq[string]() + if statesOption.isSome: + for state in statesOption.get: ctx.loadIssues(state) + else: ctx.loadAllIssues() + + if filterOption.isSome: ctx.filterIssues(filterOption.get) + + for state, issueList in ctx.issues: + for issue in issueList: + for tag in issue.tags: + if not uniqTags.contains(tag): uniqTags.add(tag) + + stdout.writeLine(uniqTags.sorted.join("\n")) + # List a specific issue elif issueIdsOption.isSome: for issueId in issueIdsOption.get: diff --git a/src/pitpkg/cliconstants.nim b/src/pitpkg/cliconstants.nim index 7ad16be..f91ce1b 100644 --- a/src/pitpkg/cliconstants.nim +++ b/src/pitpkg/cliconstants.nim @@ -1,8 +1,9 @@ -const PIT_VERSION* = "4.26.0" +const PIT_VERSION* = "4.27.0" const USAGE* = """Usage: pit ( new | add) [] [options] pit list contexts [options] + pit list tags [options] pit list [...] [options] pit ( start | done | pending | todo-today | todo | suspend ) ... [options] pit edit ... [options]