Skip to content

Commit

Permalink
change make logs quiet by default and adds a verbose flag to enable v…
Browse files Browse the repository at this point in the history
…erbose log output
  • Loading branch information
olamilekan000 committed Dec 23, 2024
1 parent 036c68a commit 7c46686
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ _artifacts/
lima.REJECTED.yaml
schema-limayaml.json
.config
.vscode
21 changes: 13 additions & 8 deletions cmd/limactl/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ func newCopyCommand() *cobra.Command {
}

copyCommand.Flags().BoolP("recursive", "r", false, "copy directories recursively")
copyCommand.Flags().BoolP("quiet", "q", false, "suppress output logs")
copyCommand.Flags().BoolP("quiet", "q", true, "suppress output logs (default: true)")
copyCommand.Flags().BoolP("verbose", "v", false, "enable verbose output")

return copyCommand
}
Expand All @@ -44,11 +45,20 @@ func copyAction(cmd *cobra.Command, args []string) error {
return err
}

verbose, err := cmd.Flags().GetBool("verbose")
if err != nil {
return err
}

quiet, err := cmd.Flags().GetBool("quiet")
if err != nil {
return err
}

if verbose {
quiet = false
}

arg0, err := exec.LookPath("scp")
if err != nil {
return err
Expand All @@ -58,12 +68,7 @@ func copyAction(cmd *cobra.Command, args []string) error {
scpFlags := []string{}
scpArgs := []string{}

debug, err := cmd.Flags().GetBool("debug")
if err != nil {
return err
}

if debug && !quiet {
if verbose {
scpFlags = append(scpFlags, "-v")
}

Expand Down Expand Up @@ -133,7 +138,7 @@ func copyAction(cmd *cobra.Command, args []string) error {
sshCmd.Stderr = cmd.ErrOrStderr()
}

if debug && !quiet {
if verbose {
logrus.Debugf("executing scp (may take a long time)): %+v", sshCmd.Args)
}

Expand Down

0 comments on commit 7c46686

Please sign in to comment.