Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: flag to suppress the command output #338

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func execute(cmd *cobra.Command, args []string) (err error) {
command := strings.Join(commands, "; ")

// Show final command before executing it
fmt.Printf("> %s\n", command)
if !flag.Silent {
fmt.Printf("> %s\n", command)
}

return run(command, os.Stdin, os.Stdout)
}
Expand All @@ -46,4 +48,6 @@ func init() {
`Initial value for query`)
execCmd.Flags().StringVarP(&config.Flag.FilterTag, "tag", "t", "",
`Filter tag`)
execCmd.Flags().BoolVarP(&config.Flag.Silent, "silent", "s", false,
`Suppress the command output`)
}
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type FlagConfig struct {
Tag bool
UseMultiLine bool
UseEditor bool
Silent bool
}

// Load loads a config toml
Expand Down