Skip to content

Commit

Permalink
chore: rename flag variables for consistency
Browse files Browse the repository at this point in the history
The flag variables for the CLI were previously using either `print` or
`show` prefixes. This is not required as they are booleans used to
indicate if the flag is enabled. The names have now been made consistent
to enable future flag variables to be named idiomatically.

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
  • Loading branch information
snprajwal committed Jun 8, 2023
1 parent 5a2eb0c commit 590b3c8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions checkpointctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
)

var (
name string
version string
printStats bool
showMounts bool
fullPaths bool
showAll bool
name string
version string
stats bool
mounts bool
fullPaths bool
showAll bool
)

func main() {
Expand Down Expand Up @@ -47,19 +47,19 @@ func setupShow() *cobra.Command {
}
flags := cmd.Flags()
flags.BoolVar(
&printStats,
&stats,
"print-stats",
false,
"Print checkpointing statistics if available",
)
flags.BoolVar(
&printStats,
&stats,
"stats",
false,
"Print checkpointing statistics if available",
)
flags.BoolVar(
&showMounts,
&mounts,
"mounts",
false,
"Print overview about mounts used in the checkpoints",
Expand All @@ -86,10 +86,10 @@ func setupShow() *cobra.Command {

func show(cmd *cobra.Command, args []string) error {
if showAll {
printStats = true
showMounts = true
stats = true
mounts = true
}
if fullPaths && !showMounts {
if fullPaths && !mounts {
return fmt.Errorf("Cannot use --full-paths without --mounts/--all option")
}

Expand Down

0 comments on commit 590b3c8

Please sign in to comment.