M cmd/add.go => cmd/add.go +3 -1
@@ 55,7 55,9 @@ bookmarks.`,
return err
}
- fmt.Printf("Added new bookmark %s\n", b.URL)
+ if verbose {
+ fmt.Printf("Added new bookmark %s\n", b.URL)
+ }
return nil
},
M cmd/open.go => cmd/open.go +6 -2
@@ 59,9 59,13 @@ file.`,
}
for _, b := range bookmarks {
cmd := exec.Command(browserCmd, b.URL)
- fmt.Printf("Opening %s\n", b.URL)
+ if verbose {
+ fmt.Printf("Opening %s\n", b.URL)
+ }
if err := cmd.Run(); err != nil {
- fmt.Println(err)
+ if verbose {
+ fmt.Println(err)
+ }
}
}
M cmd/remove.go => cmd/remove.go +7 -3
@@ 62,7 62,9 @@ index values from the list command.`,
if strings.ToLower(string(confirm[0])) == "y" {
toDelete = append(toDelete, i)
} else {
- fmt.Printf("Skipping %d\n", i)
+ if verbose {
+ fmt.Printf("Skipping %d\n", i)
+ }
}
}
}
@@ 72,8 74,10 @@ index values from the list command.`,
return err
}
- for _, r := range removed {
- fmt.Printf("Removed %s\n", r.URL)
+ if verbose {
+ for _, r := range removed {
+ fmt.Printf("Removed %s\n", r.URL)
+ }
}
return nil
M cmd/root.go => cmd/root.go +2 -0
@@ 30,6 30,7 @@ var config *cfg.Config
var cfgFile string
var tags []string
var indices []int
+var verbose bool
var rootCmd = &cobra.Command{
Use: "bmk",
@@ 55,6 56,7 @@ func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file (default is $HOME/.config/bmk/config.yml)")
+ rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "print verbose messages")
}
func initConfig() {
M doc/bmk-add.1 => doc/bmk-add.1 +4 -0
@@ 34,6 34,10 @@ bookmarks.
\fB\-c\fP, \fB\-\-config\fP=""
config file (default is $HOME/.config/bmk/config.yml)
+.PP
+\fB\-v\fP, \fB\-\-verbose\fP[=false]
+ print verbose messages
+
.SH SEE ALSO
.PP
M doc/bmk-list.1 => doc/bmk-list.1 +4 -0
@@ 33,6 33,10 @@ description. Bookmarks will be filtered by the tags and/or description.
\fB\-c\fP, \fB\-\-config\fP=""
config file (default is $HOME/.config/bmk/config.yml)
+.PP
+\fB\-v\fP, \fB\-\-verbose\fP[=false]
+ print verbose messages
+
.SH SEE ALSO
.PP
M doc/bmk-open.1 => doc/bmk-open.1 +4 -0
@@ 34,6 34,10 @@ file.
\fB\-c\fP, \fB\-\-config\fP=""
config file (default is $HOME/.config/bmk/config.yml)
+.PP
+\fB\-v\fP, \fB\-\-verbose\fP[=false]
+ print verbose messages
+
.SH SEE ALSO
.PP
M doc/bmk-remove.1 => doc/bmk-remove.1 +4 -0
@@ 33,6 33,10 @@ index values from the list command.
\fB\-c\fP, \fB\-\-config\fP=""
config file (default is $HOME/.config/bmk/config.yml)
+.PP
+\fB\-v\fP, \fB\-\-verbose\fP[=false]
+ print verbose messages
+
.SH SEE ALSO
.PP
M doc/bmk.1 => doc/bmk.1 +4 -0
@@ 27,6 27,10 @@ without relying on a web\-browser.
\fB\-h\fP, \fB\-\-help\fP[=false]
help for bmk
+.PP
+\fB\-v\fP, \fB\-\-verbose\fP[=false]
+ print verbose messages
+
.SH SEE ALSO
.PP