Add list tags
sub-command, accept properties update to the edit
command.
This commit is contained in:
parent
4176dfea3a
commit
e955cd5b24
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "4.26.0"
|
||||
version = "4.27.0"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Personal issue tracker."
|
||||
license = "MIT"
|
||||
|
38
src/pit.nim
38
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["<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))
|
||||
@ -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["<stateOrId>"]:
|
||||
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:
|
||||
|
@ -1,8 +1,9 @@
|
||||
const PIT_VERSION* = "4.26.0"
|
||||
const PIT_VERSION* = "4.27.0"
|
||||
|
||||
const USAGE* = """Usage:
|
||||
pit ( new | add) <summary> [<state>] [options]
|
||||
pit list contexts [options]
|
||||
pit list tags [options]
|
||||
pit list [<stateOrId>...] [options]
|
||||
pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options]
|
||||
pit edit <ref>... [options]
|
||||
|
Loading…
x
Reference in New Issue
Block a user