From e6faee1573998c3ab6f9dd083bd4aa13876704ee Mon Sep 17 00:00:00 2001 From: Cory Bennett Date: Wed, 6 Sep 2017 22:30:15 -0700 Subject: [PATCH] [#66] add --started option to `jira worklog add` to change the start time for worklog --- jiracli/templates.go | 3 ++- jiracmd/worklogAdd.go | 1 + t/110basic-worklog.t | 10 +++------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/jiracli/templates.go b/jiracli/templates.go index 15a61553..8a758ae1 100644 --- a/jiracli/templates.go +++ b/jiracli/templates.go @@ -449,12 +449,13 @@ const defaultWorklogTemplate = `{{/* worklog template */ -}} comment: |~ {{ or .comment "" }} timeSpent: {{ or .timeSpent "" }} -started: +started: {{ or .started "" }} ` const defaultWorklogsTemplate = `{{/* worklogs template */ -}} {{ range .worklogs }}- # {{.author.name}}, {{.created | age}} ago comment: {{ or .comment "" }} + started: {{ .started }} timeSpent: {{ .timeSpent }} {{end}}` diff --git a/jiracmd/worklogAdd.go b/jiracmd/worklogAdd.go index d6186d23..654a19b3 100644 --- a/jiracmd/worklogAdd.go +++ b/jiracmd/worklogAdd.go @@ -42,6 +42,7 @@ func CmdWorklogAddUsage(cmd *kingpin.CmdClause, opts *WorklogAddOptions) error { cmd.Flag("noedit", "Disable opening the editor").SetValue(&opts.SkipEditing) cmd.Flag("comment", "Comment message for worklog").Short('m').StringVar(&opts.Comment) cmd.Flag("time-spent", "Time spent working on issue").Short('T').StringVar(&opts.TimeSpent) + cmd.Flag("started", "Time you started work").Short('S').StringVar(&opts.Started) cmd.Arg("ISSUE", "issue id to fetch worklogs").Required().StringVar(&opts.Issue) return nil } diff --git a/t/110basic-worklog.t b/t/110basic-worklog.t index 77b9e176..0e484d2a 100755 --- a/t/110basic-worklog.t +++ b/t/110basic-worklog.t @@ -2,12 +2,7 @@ eval "$(curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh)" cd $(dirname $0) jira="../jira" -export JIRA_LOG_FORMAT="%{level:-5s} %{message}" - -ENDPOINT="http://localhost:8080" -if [ -n "$JIRACLOUD" ]; then - ENDPOINT="https://go-jira.atlassian.net" -fi +. env.sh PLAN 8 @@ -31,7 +26,7 @@ EOF ############################################################################### ## Add a worklog to an issue ############################################################################### -RUNS $jira worklog add $issue --comment "work is hard" --time-spent "1h 12m" --noedit +RUNS $jira worklog add $issue --comment "work is hard" --time-spent "1h 12m" -S "2017-01-29T09:17:00.000-0500" --noedit DIFF <