Skip to content

Commit 399f819

Browse files
committed
add --beep flag
1 parent 4e41dca commit 399f819

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/root.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313

1414
var (
1515
version string
16+
17+
flagBeep bool
1618
)
1719

1820
var rootCmd = &cobra.Command{
@@ -44,6 +46,9 @@ var rootCmd = &cobra.Command{
4446
if _, err := p.Run(); err != nil {
4547
return err
4648
}
49+
if flagBeep {
50+
fmt.Fprint(os.Stderr, "\a")
51+
}
4752
if m.Aborted() {
4853
os.Exit(130)
4954
}
@@ -67,4 +72,5 @@ func init() {
6772
}
6873
rootCmd.Version = version
6974

75+
rootCmd.Flags().BoolVarP(&flagBeep, "beep", "b", false, "beep when the sheep wakes up")
7076
}

0 commit comments

Comments
 (0)