Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
3ximus committed Dec 11, 2023
1 parent 74cfae1 commit 79554f1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,29 @@ include_branch_name: true

# define custom status for jira tickets, to more easily filter by the preset options and colorize output
jira_status:
inprogress: ['In Progress', 'Selected for Development']
todo: ['À FAIRE']
open: ['OUVERT', 'To estimate_T']

inprogress:
values: ["In Progress", "In Progress_T"]
icon: "" # ﲊ 羽  
color: "1;34" # if I want to remove icon 1;38;5;235;44
todo:
values: ["À FAIRE"]
icon: "" #  
color: "1;33"
blocked:
values: ["Blocked"]
icon: "" #  ﰸ  
color: "1;31"

# same for jira tickets
jira_type:
bug:
values: ["Bug"]
icon: ""
color: "1;31"
task:
values: ["Tâche"]
icon: ""
color: "1;34"
```
### Setup autocompletion
Expand All @@ -60,8 +79,6 @@ bb help [COMMAND]
TODO


### NOTE TO SELF
To generate documentation use this
Expand Down
7 changes: 5 additions & 2 deletions api/jira-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"
"net/url"
"time"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -166,13 +167,15 @@ func PostTransitions(key string, transition string) {
jiraApiPost(fmt.Sprintf("/issue/%s/transitions", key), bytes.NewReader(content))
}

// Post worklog in seconds
// Post worklog in seconds and set start time to seconds before current time
func PostWorklog(key string, seconds int) {
var worklogDTO = struct {
// TODO add a Started field that's the current time - seconds
TimeSpent int `json:"timeSpentSeconds"`
TimeSpent int `json:"timeSpentSeconds"`
Started string `json:"started"`
}{}
worklogDTO.TimeSpent = seconds
worklogDTO.Started = time.Now().Add(time.Duration(-seconds) * time.Second).Format(time.RFC3339)
content, err := json.Marshal(worklogDTO)
cobra.CheckErr(err)
jiraApiPost(fmt.Sprintf("/issue/%s/worklog", key), bytes.NewReader(content))
Expand Down
2 changes: 0 additions & 2 deletions cmd/issue/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ var LogCmd = &cobra.Command{
seconds, err := util.ConvertToSeconds(args[1:])
cobra.CheckErr(err)

// TODO allow choosing start time ( maybe lookup last logged time like it's possible to do from within a ticket in jira)

api.PostWorklog(key, seconds)
fmt.Printf("Logged time for %s +\033[1;32m%d\033[m\n", key, seconds)

Expand Down

0 comments on commit 79554f1

Please sign in to comment.