Skip to content

Commit

Permalink
(fix): fixing 'no-config' flag on clone sub-command
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassabreu committed Jul 9, 2020
1 parent 20525fa commit a10edf4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.8.1] - 2020-07-09

### Fixed

- `clone` sub-command was not working because the `no-closing` viper config was being
connected with a non-existing `--no-closing` flag in the `in` sub-command, that does
not exist anymore.

## [v0.8.0] - 2020-07-08

### Added
Expand Down Expand Up @@ -280,7 +288,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.8.0...HEAD
[Unreleased]: https://github.com/lucassabreu/clockify-cli/compare/v0.8.1...HEAD
[v0.8.1]: https://github.com/lucassabreu/clockify-cli/releases/tag/v0.8.1
[v0.8.0]: https://github.com/lucassabreu/clockify-cli/releases/tag/v0.8.0
[v0.7.2]: https://github.com/lucassabreu/clockify-cli/releases/tag/v0.7.2
[v0.7.1]: https://github.com/lucassabreu/clockify-cli/releases/tag/v0.7.1
Expand Down
7 changes: 3 additions & 4 deletions cmd/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ var cloneCmd = &cobra.Command{
}

format, _ := cmd.Flags().GetString("format")
noClosing, _ := cmd.Flags().GetBool("no-closing")
asJSON, _ := cmd.Flags().GetBool("json")
err = newEntry(c, tec, viper.GetBool("interactive"), !viper.GetBool("no-closing"), format, asJSON)
err = newEntry(c, tec, viper.GetBool("interactive"), !noClosing, format, asJSON)
if err != nil {
printError(err)
}
Expand Down Expand Up @@ -108,9 +109,7 @@ func init() {

addTimeEntryFlags(cloneCmd)

cloneCmd.PersistentFlags().BoolVar(&noClosing, "no-closing", false, "don't close any active time entry")
_ = viper.BindPFlag("no-closing", inCmd.PersistentFlags().Lookup("no-closing"))

cloneCmd.Flags().BoolP("no-closing", "", false, "don't close any active time entry")
cloneCmd.Flags().StringP("format", "f", "", "golang text/template format to be applied on each time entry")
cloneCmd.Flags().BoolP("json", "j", false, "print as json")
}

0 comments on commit a10edf4

Please sign in to comment.