Skip to content

Commit

Permalink
(release): v0.19.3 (#110)
Browse files Browse the repository at this point in the history
* (feat): delete multiple

* (fix): clone entry, but not end time

* (release): 0.19.3
  • Loading branch information
lucassabreu authored Jul 20, 2021
1 parent 334803e commit ffd1022
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 20 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.19.3] - 2021-07-20

### Fixed

- `clone` should create a open time entry by default.

### Changed

- `delete` command accepts multiple ids instead of just one.

## [v0.19.2] - 2021-07-20

### Fixed
Expand Down Expand Up @@ -533,7 +543,8 @@ time entry.
- Golang CLI using [cobra](https://github.com/spf13/cobra)
- Makefile to help setup actions

[Unreleased]: https://github.com/lucassabreu/clockify-cli/compare/v0.19.2...HEAD
[Unreleased]: https://github.com/lucassabreu/clockify-cli/compare/v0.19.3...HEAD
[v0.19.3]: https://github.com/lucassabreu/clockify-cli/releases/tag/v0.19.3
[v0.19.2]: https://github.com/lucassabreu/clockify-cli/releases/tag/v0.19.2
[v0.19.1]: https://github.com/lucassabreu/clockify-cli/releases/tag/v0.19.1
[v0.19.0]: https://github.com/lucassabreu/clockify-cli/releases/tag/v0.19.0
Expand Down
1 change: 1 addition & 0 deletions cmd/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var cloneCmd = &cobra.Command{
userId,
c,
)
tec.TimeInterval.End = nil

if err != nil {
return err
Expand Down
43 changes: 24 additions & 19 deletions cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,39 @@ import (

// deleteCmd represents the delete command
var deleteCmd = &cobra.Command{
Use: "delete [current|<time-entry-id>]",
Use: "delete [current|<time-entry-id>]...",
Aliases: []string{"del", "rm", "remove"},
Args: cobra.ExactArgs(1),
Args: cobra.MinimumNArgs(1),
ValidArgs: []string{"current"},
Short: `Delete a time entry, use id "current" to apply to time entry in progress`,
Short: `Delete time entry(ies), use id "current" to apply to time entry in progress`,
RunE: withClockifyClient(func(cmd *cobra.Command, args []string, c *api.Client) error {
param := api.DeleteTimeEntryParam{
Workspace: viper.GetString(WORKSPACE),
TimeEntryID: args[0],
}
for i := range args {
param := api.DeleteTimeEntryParam{
Workspace: viper.GetString(WORKSPACE),
TimeEntryID: args[i],
}

if param.TimeEntryID == "current" {
te, err := c.LogInProgress(api.LogInProgressParam{
Workspace: param.Workspace,
})
if param.TimeEntryID == "current" {
te, err := c.LogInProgress(api.LogInProgressParam{
Workspace: param.Workspace,
})

if err != nil {
return err
}
if err != nil {
return err
}

if te == nil {
return errors.New("there is no time entry in progress")
if te == nil {
return errors.New("there is no time entry in progress")
}

param.TimeEntryID = te.ID
}

param.TimeEntryID = te.ID
if err := c.DeleteTimeEntry(param); err != nil {
return err
}
}

return c.DeleteTimeEntry(param)
return nil
}),
}

Expand Down

0 comments on commit ffd1022

Please sign in to comment.