CanastaWiki / Canasta-CLI

The Canasta command line interface, written in Go
MIT License
5 stars 14 forks source link

Added propagating verbose to subcommands support #72

Closed chl178 closed 1 year ago

chl178 commented 1 year ago

Related Issue: #61 The following PR Added propagating verbose to subcommands support

Areas of discussion

In the Canasta-CLI, internal commands can propagate verbose to their internal subcommands, but can't propagate verbose to external subcommands called by exec.Command(). To get more info when executing external subcommands especially docker-compose, I passed the verbose flag to the external subcommands from their parent commands.

Changes made

  1. Added the 'GetVerbose()' function in the logging package
  2. Implemented a conditional statement before executing the external command to determine whether to include the '--verbose' argument based on the value of the verbose flag.

Test

Only docker-compose has the –-verbose option among these external commands, so the following show the commands successfully propagate verbose to docker-compose subcommands. 截屏2023-03-15 14 07 34 截屏2023-03-15 14 10 10

This is my first time contributing to the community. Any feedback or suggestions are greatly appreciated.

chl178 commented 1 year ago

@jeffw16 @yaronkoren

jeffw16 commented 1 year ago

@bawolff do you have time to take a look at this?