Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/copy-jira.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,7 @@ func init() {
jiraCmd.Flags().StringVarP(&startDate, "start", "s", firstDayOfMonth, "start date")
today := time.Now().Format("2006-01-02")
jiraCmd.Flags().StringVarP(&endDate, "end", "e", today, "end date")
jiraCmd.Flags().StringVarP(
&userNameFromCmd, "user", "u", "", "name of the user whose entries should be transferred",
)
}
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var exportDate string
var userNameFromCmd string
var cfg *config.Config
var tmetricUser tmetric.User
var tmetricActor tmetric.User

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Expand All @@ -46,6 +47,7 @@ var rootCmd = &cobra.Command{
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
cfg = config.NewConfig()
tmetricUserMe := tmetric.NewUser()
tmetricActor = tmetricUserMe
var err error
if userNameFromCmd == "" {
tmetricUser = tmetricUserMe
Expand Down
9 changes: 6 additions & 3 deletions cmd/tmetric.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ func handleEntriesWithoutIssue(timeEntries []tmetric.TimeEntry) error {
spinner.Start()
spinner.Prefix = fmt.Sprintf("Updating t-metric entry '%v' ", entry.Note)
spinner.FinalMSG = "❌\n"
latestTimeEntry, err := tmetric.CreateDummyTimeEntry(dummyTimeEntry, tmetricUser, cfg)
latestTimeEntry, err := tmetric.CreateDummyTimeEntry(dummyTimeEntry, tmetricActor, cfg)
if err != nil {
return err
}
_ = latestTimeEntry.Delete(*cfg, tmetricUser)
_ = latestTimeEntry.Delete(*cfg, tmetricActor)
entry.Task = latestTimeEntry.Task
err = entry.Update(*cfg, tmetricUser)
err = entry.Update(*cfg, tmetricActor)
if err != nil {
return err
}
Expand Down Expand Up @@ -316,4 +316,7 @@ func init() {
tmetricCmd.Flags().StringVarP(&startDate, "start", "s", firstDayOfMonth, "start date")
today := time.Now().Format("2006-01-02")
tmetricCmd.Flags().StringVarP(&endDate, "end", "e", today, "end date")
tmetricCmd.Flags().StringVarP(
&userNameFromCmd, "user", "u", "", "name of the user whose entries should be checked",
)
}
Loading