Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
4127fbe41c | |||
0671d7728e | |||
7b5f26f24a | |||
db3e648d47 | |||
476a94c679 |
20
pit.nimble
20
pit.nimble
@ -1,8 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
include "src/pitpkg/version.nim"
|
version = "4.7.0"
|
||||||
|
|
||||||
version = PIT_VERSION
|
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Personal issue tracker."
|
description = "Personal issue tracker."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -11,5 +9,17 @@ bin = @["pit", "pit_api"]
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
requires @[ "nim >= 0.19.0", "cliutils 0.6.1", "docopt 0.6.8", "jester 0.4.1",
|
requires @[
|
||||||
"langutils >= 0.4.0", "timeutils 0.4.0", "uuids 0.1.10" ]
|
"nim >= 0.19.0",
|
||||||
|
"docopt 0.6.8",
|
||||||
|
"jester 0.4.1",
|
||||||
|
"uuids 0.1.10",
|
||||||
|
|
||||||
|
"https://git.jdb-labs.com/jdb/nim-cli-utils.git >= 0.6.1",
|
||||||
|
"https://git.jdb-labs.com/jdb/nim-lang-utils.git >= 0.4.0",
|
||||||
|
"https://git.jdb-labs.com/jdb/nim-time-utils.git >= 0.4.0",
|
||||||
|
"https://git.jdb-labs.com/jdb/update-nim-package-version"
|
||||||
|
]
|
||||||
|
|
||||||
|
task updateVersion, "Update the version of this package.":
|
||||||
|
exec "update_nim_package_version pit 'src/pitpkg/version.nim'"
|
40
src/pit.nim
40
src/pit.nim
@ -1,11 +1,11 @@
|
|||||||
## Personal Issue Tracker CLI interface
|
## Personal Issue Tracker CLI interface
|
||||||
## ====================================
|
## ====================================
|
||||||
|
|
||||||
import cliutils, docopt, json, logging, options, os, ospaths, sequtils,
|
import cliutils, docopt, json, logging, options, os, sequtils,
|
||||||
tables, terminal, times, timeutils, unicode, uuids
|
tables, terminal, times, timeutils, unicode, uuids
|
||||||
|
|
||||||
from nre import re
|
from nre import re
|
||||||
import strutils except capitalize, toUpper, toLower
|
import strutils except capitalize, strip, toUpper, toLower
|
||||||
import pitpkg/private/libpit
|
import pitpkg/private/libpit
|
||||||
export libpit
|
export libpit
|
||||||
|
|
||||||
@ -244,6 +244,8 @@ Usage:
|
|||||||
pit list [<listable>] [options]
|
pit list [<listable>] [options]
|
||||||
pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options]
|
pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options]
|
||||||
pit edit <ref>...
|
pit edit <ref>...
|
||||||
|
pit tag <id>... [options]
|
||||||
|
pit untag <id>... [options]
|
||||||
pit reorder <state>
|
pit reorder <state>
|
||||||
pit delegate <id> <delegated-to>
|
pit delegate <id> <delegated-to>
|
||||||
pit ( delete | rm ) <id>...
|
pit ( delete | rm ) <id>...
|
||||||
@ -357,6 +359,29 @@ Options:
|
|||||||
|
|
||||||
else: edit(ctx.tasksDir.loadIssueById(editRef))
|
else: edit(ctx.tasksDir.loadIssueById(editRef))
|
||||||
|
|
||||||
|
elif args["tag"]:
|
||||||
|
if not args["--tags"]: raise newException(Exception, "no tags given")
|
||||||
|
|
||||||
|
let newTags = ($args["--tags"]).split(",").mapIt(it.strip)
|
||||||
|
|
||||||
|
for id in @(args["<id>"]):
|
||||||
|
var issue = ctx.tasksDir.loadIssueById(id)
|
||||||
|
issue.tags = deduplicate(issue.tags & newTags)
|
||||||
|
issue.store()
|
||||||
|
|
||||||
|
elif args["untag"]:
|
||||||
|
let tagsToRemove: seq[string] =
|
||||||
|
if args["--tags"]: ($args["--tags"]).split(",").mapIt(it.strip)
|
||||||
|
else: @[]
|
||||||
|
|
||||||
|
for id in @(args["<id>"]):
|
||||||
|
var issue = ctx.tasksDir.loadIssueById(id)
|
||||||
|
if tagsToRemove.len > 0:
|
||||||
|
issue.tags = issue.tags.filter(
|
||||||
|
proc (tag: string): bool = not tagsToRemove.anyIt(it == tag))
|
||||||
|
else: issue.tags = @[]
|
||||||
|
issue.store()
|
||||||
|
|
||||||
elif args["start"] or args["todo-today"] or args["done"] or
|
elif args["start"] or args["todo-today"] or args["done"] or
|
||||||
args["pending"] or args["todo"] or args["suspend"]:
|
args["pending"] or args["todo"] or args["suspend"]:
|
||||||
|
|
||||||
@ -379,8 +404,15 @@ Options:
|
|||||||
if ctx.triggerPtk:
|
if ctx.triggerPtk:
|
||||||
if targetState == Current:
|
if targetState == Current:
|
||||||
let issue = ctx.tasksDir.loadIssueById($(args["<id>"][0]))
|
let issue = ctx.tasksDir.loadIssueById($(args["<id>"][0]))
|
||||||
var cmd = "ptk start "
|
var cmd = "ptk start"
|
||||||
if issue.tags.len > 0: cmd &= "-g \"" & issue.tags.join(",") & "\""
|
if issue.tags.len > 0 or issue.properties.hasKey("context"):
|
||||||
|
let tags = concat(
|
||||||
|
issue.tags,
|
||||||
|
if issue.properties.hasKey("context"): @[issue.properties["context"]]
|
||||||
|
else: @[]
|
||||||
|
)
|
||||||
|
cmd &= " -g \"" & tags.join(",") & "\""
|
||||||
|
cmd &= " -n \"pit-id: " & $issue.id & "\""
|
||||||
cmd &= " \"" & issue.summary & "\""
|
cmd &= " \"" & issue.summary & "\""
|
||||||
discard execShellCmd(cmd)
|
discard execShellCmd(cmd)
|
||||||
elif targetState == Done or targetState == Pending:
|
elif targetState == Done or targetState == Pending:
|
||||||
|
@ -146,7 +146,8 @@ proc toStorageFormat*(issue: Issue, withComments = false): string =
|
|||||||
if withComments: lines.add("# Summary (one line):")
|
if withComments: lines.add("# Summary (one line):")
|
||||||
lines.add(issue.summary)
|
lines.add(issue.summary)
|
||||||
if withComments: lines.add("# Properties (\"key:value\" per line):")
|
if withComments: lines.add("# Properties (\"key:value\" per line):")
|
||||||
for key, val in issue.properties: lines.add(key & ": " & val)
|
for key, val in issue.properties:
|
||||||
|
if not val.isNilOrWhitespace: lines.add(key & ": " & val)
|
||||||
if issue.tags.len > 0: lines.add("tags: " & issue.tags.join(","))
|
if issue.tags.len > 0: lines.add("tags: " & issue.tags.join(","))
|
||||||
if not isNilOrWhitespace(issue.details) or withComments:
|
if not isNilOrWhitespace(issue.details) or withComments:
|
||||||
if withComments: lines.add("# Details go below the \"--------\"")
|
if withComments: lines.add("# Details go below the \"--------\"")
|
||||||
@ -178,7 +179,7 @@ proc store*(tasksDir: string, issue: Issue, state: IssueState, withComments = fa
|
|||||||
else:
|
else:
|
||||||
issue.filepath = stateDir / filename
|
issue.filepath = stateDir / filename
|
||||||
|
|
||||||
issue.store()
|
issue.store(withComments)
|
||||||
|
|
||||||
proc storeOrder*(issues: seq[Issue], path: string) =
|
proc storeOrder*(issues: seq[Issue], path: string) =
|
||||||
var orderLines = newSeq[string]()
|
var orderLines = newSeq[string]()
|
||||||
|
@ -1 +1 @@
|
|||||||
const PIT_VERSION* = "4.4.4"
|
const PIT_VERSION* = "4.7.0"
|
Reference in New Issue
Block a user