Skip to content

Commit

Permalink
feat: Add verbose flag
Browse files Browse the repository at this point in the history
Signed-off-by: AlexNg <contact@ngjx.org>
  • Loading branch information
caffeine-addictt committed Aug 30, 2024
1 parent 4ea3586 commit 921f0ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmd/options/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type GlobalOptions struct {

// Wheter or not debug mode should be enabled
Debug bool

// Wheter or not verbose mode should be enabled
Verbose bool
}

// To resolve the options after the user has provided them
Expand Down
5 changes: 3 additions & 2 deletions cmd/options/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (

// The global options for the CLI
var GlobalOpts = GlobalOptions{
Debug: false,
Repo: *types.NewValueGuardNoParsing("", "<repo>"),
Debug: false,
Verbose: false,
Repo: *types.NewValueGuardNoParsing("", "<repo>"),
CacheDir: *types.NewValueGuard("", func(v string) (string, error) {
ok, err := utils.IsDir(v)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var RootCmd = &cobra.Command{
// Setting up configuration
func init() {
RootCmd.PersistentFlags().BoolVarP(&options.GlobalOpts.Debug, "debug", "d", false, "debug mode [default: false]")
RootCmd.PersistentFlags().BoolVarP(&options.GlobalOpts.Verbose, "verbose", "v", false, "verbose mode [default: false]")
RootCmd.PersistentFlags().VarP(&options.GlobalOpts.Repo, "repo", "r", "community source repository for templates")
RootCmd.PersistentFlags().VarP(&options.GlobalOpts.CacheDir, "cache", "C", "where source repository will be cloned to [default: $XDG_CONFIG_HOME/template]")

Expand Down

0 comments on commit 921f0ca

Please sign in to comment.