piknik

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README | LICENSE

commit 4d7ec80aacad03ef9601e7002169bb003e399866
parent edf8eebe26924c9785b5df4325a0fc61cd641fba
Author: lash <dev@holbrook.no>
Date:   Sat, 22 Apr 2023 09:22:57 +0100

List aliases in show cmd, disposable pgp key in cli test

Diffstat:
M.piknik/.msg/.master | 0
Mpiknik/basket.py | 4++--
Mpiknik/cli/add.py | 1-
Mpiknik/render/plain.py | 5++++-
Mpiknik/runnable/cmd.py | 1+
Mpiknik/store/__init__.py | 2+-
Mtest_cli.sh | 9++++++++-
7 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/.piknik/.msg/.master b/.piknik/.msg/.master Binary files differ. diff --git a/piknik/basket.py b/piknik/basket.py @@ -49,10 +49,10 @@ class Basket: def add(self, issue): issue_id = str(issue.id) j = str(issue) - self.state.put(issue_id, contents=j) - self.__tags.put(issue_id) if issue.alias != None: self.__alias.put(issue.alias, issue.id) + self.state.put(issue_id, contents=j) + self.__tags.put(issue_id) return issue_id diff --git a/piknik/cli/add.py b/piknik/cli/add.py @@ -8,7 +8,6 @@ ctx = None def subparser(argp): - argp.add_argument('-a', '--alias', dest='alias', type=str, help='alias string to refer to issue to with cli commands') argp.add_argument('title', type=str, nargs='*', help='issue title') return argp diff --git a/piknik/render/plain.py b/piknik/render/plain.py @@ -50,11 +50,14 @@ class Renderer(BaseRenderer): if self.render_mode == 0: return self.apply_issue_standalone(state, issue, tags, accumulator=accumulator) - s = '{}\t{}\t{}\n'.format( + s = '{}\t{}\t{}'.format( issue.title, ','.join(tags), issue.id, ) + if issue.alias != None: + s += " (" + issue.alias + ")" + s += "\n" self.add(s, accumulator=accumulator) super(Renderer, self).apply_issue(state, issue, tags, accumulator=accumulator) diff --git a/piknik/runnable/cmd.py b/piknik/runnable/cmd.py @@ -26,6 +26,7 @@ argp.add_argument('-f', '--files', dest='f', action='store_true', help='Save att argp.add_argument('-o', '--files-dir', dest='files_dir', type=str, help='Directory to output saved files to') argp.add_argument('-v', action='store_true', help='Turn on debug logs') argp.add_argument('-i','--issue-id', type=str, help='Issue id to show') +argp.add_argument('--alias', type=str, help='alias string to refer to issue to with cli commands') argp.add_argument('cmd', type=str, nargs='?', choices=['show', 'add', 'mod', 'comment'], help='subcommand to execute') strargs = copy.copy(sys.argv[1:]) diff --git a/piknik/store/__init__.py b/piknik/store/__init__.py @@ -70,7 +70,7 @@ class AliasDir: u = uuid.UUID(v) fp = os.path.join(self.dir, k) logg.debug('putting {} {}'.format(u.bytes.hex(), fp)) - f = open(fp, 'wb') + f = open(fp, 'xb') f.write(u.bytes) f.close() diff --git a/test_cli.sh b/test_cli.sh @@ -6,11 +6,18 @@ set -x default_pythonpath=$PYTHONPATH:. export PYTHONPATH=${default_pythonpath:-.} d=`mktemp -d` +g=`mktemp -d` + +# works with gnupg 2.2.41 +gpg --homedir $g --passphrase '' --quick-generate-key --pinentry loopback --yes testuser +fp=`gpg --list-keys --homedir $g testuser 2> /dev/null | awk '/^ / {print $1;}'` + i_foo=`python piknik/runnable/cmd.py add "foo"` i_bar=`python piknik/runnable/cmd.py add "bar"` + python piknik/runnable/cmd.py mod --accept -i $i_foo python piknik/runnable/cmd.py mod --finish -i $i_bar -python piknik/runnable/cmd.py comment -x bazbazbaz -i $i_foo +GNUPGHOME=$g python piknik/runnable/cmd.py comment -s $fp -x bazbazbaz -i $i_foo python piknik/runnable/cmd.py show python piknik/runnable/cmd.py show -r html python piknik/runnable/cmd.py show -i $i_foo