Skip to content

Commit

Permalink
refactor: remove panic on command error
Browse files Browse the repository at this point in the history
  • Loading branch information
Trugamr committed Aug 4, 2024
1 parent 4a38c05 commit 388f4a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cmd

import (
"os"

"github.com/spf13/cobra"
)

Expand All @@ -13,6 +15,6 @@ var rootCmd = &cobra.Command{
func Execute() {
err := rootCmd.Execute()
if err != nil {
panic(err)
os.Exit(1)
}
}
4 changes: 2 additions & 2 deletions cmd/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func init() {

var sendCmd = &cobra.Command{
Use: "send [mac address]",
Short: "Send a magic packet to wake up a device",
Long: "Send a magic packet to wake up a device on the network",
Short: "Send a magic packet to specified mac address",
Long: "Send a magic packet to wake up a device on the network using the specified mac address",
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
Run: func(cmd *cobra.Command, args []string) {
mac, err := net.ParseMAC(args[0])
Expand Down

0 comments on commit 388f4a3

Please sign in to comment.