Compare commits

..

2 Commits

5 changed files with 40 additions and 6 deletions

2
.mise.toml Normal file
View File

@ -0,0 +1,2 @@
[tools]
nim = "2.2.0"

View File

@ -1 +0,0 @@
nim 2.2.0

View File

@ -1,6 +1,6 @@
# Package # Package
version = "4.26.0" version = "4.27.0"
author = "Jonathan Bernard" author = "Jonathan Bernard"
description = "Personal issue tracker." description = "Personal issue tracker."
license = "MIT" license = "MIT"

View File

@ -253,7 +253,8 @@ proc list(
ctx: CliContext, ctx: CliContext,
filter: Option[IssueFilter], filter: Option[IssueFilter],
states: Option[seq[IssueState]], states: Option[seq[IssueState]],
showToday, showFuture, showToday = false,
showFuture = false,
showHidden = false, showHidden = false,
verbose: bool) = verbose: bool) =
@ -427,6 +428,11 @@ when isMainModule:
elif args["edit"]: elif args["edit"]:
for editRef in @(args["<ref>"]): for editRef in @(args["<ref>"]):
let propsOption =
if args["--properties"]:
some(parsePropertiesOption($args["--properties"]))
else: none(TableRef[string, string])
var stateOption = none(IssueState) var stateOption = none(IssueState)
try: stateOption = some(parseEnum[IssueState](editRef)) try: stateOption = some(parseEnum[IssueState](editRef))
@ -435,9 +441,18 @@ when isMainModule:
if stateOption.isSome: if stateOption.isSome:
let state = stateOption.get let state = stateOption.get
ctx.loadIssues(state) 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"]: elif args["tag"]:
if tagsOption.isNone: raise newException(Exception, "no tags given") if tagsOption.isNone: raise newException(Exception, "no tags given")
@ -578,10 +593,12 @@ when isMainModule:
filter.exclProperties.del("context") filter.exclProperties.del("context")
var listContexts = false var listContexts = false
var listTags = false
var statesOption = none(seq[IssueState]) var statesOption = none(seq[IssueState])
var issueIdsOption = none(seq[string]) var issueIdsOption = none(seq[string])
if args["contexts"]: listContexts = true if args["contexts"]: listContexts = true
elif args["tags"]: listTags = true
elif args["<stateOrId>"]: elif args["<stateOrId>"]:
try: try:
statesOption = statesOption =
@ -607,6 +624,21 @@ when isMainModule:
for c in uniqContexts.sorted: for c in uniqContexts.sorted:
stdout.writeLine(c.alignLeft(maxLen+2) & ctx.getIssueContextDisplayName(c)) 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 # List a specific issue
elif issueIdsOption.isSome: elif issueIdsOption.isSome:
for issueId in issueIdsOption.get: for issueId in issueIdsOption.get:

View File

@ -1,8 +1,9 @@
const PIT_VERSION* = "4.26.0" const PIT_VERSION* = "4.27.0"
const USAGE* = """Usage: const USAGE* = """Usage:
pit ( new | add) <summary> [<state>] [options] pit ( new | add) <summary> [<state>] [options]
pit list contexts [options] pit list contexts [options]
pit list tags [options]
pit list [<stateOrId>...] [options] pit list [<stateOrId>...] [options]
pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options] pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options]
pit edit <ref>... [options] pit edit <ref>... [options]