diff --git a/pit.nimble b/pit.nimble index 8dd9ebb..f0832cb 100644 --- a/pit.nimble +++ b/pit.nimble @@ -1,6 +1,6 @@ # Package -version = "4.11.1" +version = "4.12.0" author = "Jonathan Bernard" description = "Personal issue tracker." license = "MIT" @@ -15,10 +15,11 @@ requires @[ "jester 0.5.0", "uuids 0.1.10", - "https://git.jdb-labs.com/jdb/nim-cli-utils.git >= 0.6.4", - "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" + "https://git.jdb-software.com/jdb/nim-cli-utils.git >= 0.6.4", + "https://git.jdb-software.com/jdb/nim-lang-utils.git >= 0.4.0", + "https://git.jdb-software.com/jdb/nim-time-utils.git >= 0.4.0", + "https://git.jdb-software.com/jdb/nim-data-uri.git >= 1.0.0", + "https://git.jdb-software.com/jdb/update-nim-package-version" ] task updateVersion, "Update the version of this package.": diff --git a/src/pit.nim b/src/pit.nim index 22d3be6..b0ecbfe 100644 --- a/src/pit.nim +++ b/src/pit.nim @@ -1,8 +1,8 @@ ## Personal Issue Tracker CLI interface ## ==================================== -import algorithm, cliutils, docopt, json, logging, options, os, sequtils, - std/wordwrap, tables, terminal, times, timeutils, unicode, uuids +import algorithm, cliutils, data_uri, docopt, json, logging, options, os, + sequtils, std/wordwrap, tables, terminal, times, timeutils, unicode, uuids from nre import re import strutils except alignLeft, capitalize, strip, toUpper, toLower @@ -250,6 +250,8 @@ Usage: pit reorder pit delegate pit ( delete | rm ) ... + pit add-binary-property + pit get-binary-property Options: @@ -513,6 +515,33 @@ Options: showBoth or args["--future"], ctx.verbose) + elif args["add-binary-property"]: + let issue = ctx.tasksDir.loadIssueById($(args[""])) + + let propIn = + if $(args[""]) == "-": stdin + else: open($(args[""])) + + try: issue[$(args[""])] = encodeAsDataUri(readAll(propIn)) + finally: close(propIn) + + issue.store() + + elif args["get-binary-property"]: + let issue = ctx.tasksDir.loadIssueById($(args[""])) + + if not issue.hasProp($(args[""])): + raise newException(Exception, + "issue " & ($issue.id)[0..<6] & " has no property name '" & + $(args[""]) & "'") + + let propOut = + if $(args[""]) == "-": stdout + else: open($(args[""]), fmWrite) + + try: write(propOut, decodeDataUri(issue[$(args[""])])) + finally: close(propOut) + except: fatal "pit: " & getCurrentExceptionMsg() #raise getCurrentException() diff --git a/src/pit_api.nim b/src/pit_api.nim index fee0a8b..7984b05 100644 --- a/src/pit_api.nim +++ b/src/pit_api.nim @@ -20,7 +20,7 @@ proc raiseEx(reason: string): void = raise newException(Exception, reason) template halt(code: HttpCode, headers: RawHeaders, - content: string): typed = + content: string): void = ## Immediately replies with the specified request. This means any further ## code will not be executed after calling this template in the current ## route. diff --git a/src/pitpkg/version.nim b/src/pitpkg/version.nim index 6718991..a457e3d 100644 --- a/src/pitpkg/version.nim +++ b/src/pitpkg/version.nim @@ -1 +1 @@ -const PIT_VERSION* = "4.11.1" \ No newline at end of file +const PIT_VERSION* = "4.12.0" \ No newline at end of file