Skip to content

Commit

Permalink
[#66] add --started option to jira worklog add to change the start …
Browse files Browse the repository at this point in the history
…time for worklog
  • Loading branch information
coryb committed Sep 7, 2017
1 parent c4be59c commit e6faee1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion jiracli/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}`
1 change: 1 addition & 0 deletions jiracmd/worklogAdd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 3 additions & 7 deletions t/110basic-worklog.t
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 <<EOF
OK $issue $ENDPOINT/browse/$issue
EOF
Expand All @@ -43,6 +38,7 @@ RUNS $jira worklog $issue
DIFF <<EOF
- # gojira, a minute ago
comment: work is hard
started: 2017-01-29T06:17:00.000-0800
timeSpent: 1h 12m
EOF

0 comments on commit e6faee1

Please sign in to comment.