Commit 823862d

Karn Wong <karn@karnwong.me>
2024-01-09 02:43:48
refactor: move to get command
1 parent c2f7e2d
Changed files (3)
cmd/networking/networking.go → cmd/get/get.go
@@ -1,4 +1,4 @@
-package networking
+package get
 
 import (
 	"fmt"
@@ -7,9 +7,9 @@ import (
 )
 
 var Cmd = &cobra.Command{
-	Use:   "networking",
-	Short: "Networking tools",
-	Long:  `Networking tools`,
+	Use:   "get",
+	Short: "Obtain information",
+	Long:  `Obtain information`,
 	Run: func(cmd *cobra.Command, args []string) {
 		fmt.Println("Please specify subcommand")
 	},
cmd/networking/networking_get_ip.go → cmd/get/get_ip.go
@@ -1,4 +1,4 @@
-package networking
+package get
 
 import (
 	"encoding/json"
@@ -60,7 +60,7 @@ func getPublicIP() string {
 }
 
 var getIPCmd = &cobra.Command{
-	Use:   "get-ip",
+	Use:   "ip",
 	Short: "Get IP information",
 	Long:  `Get IP information`,
 	Run: func(cmd *cobra.Command, args []string) {
cmd/root.go
@@ -3,7 +3,7 @@ package cmd
 import (
 	"os"
 
-	"github.com/kahnwong/swissknife/cmd/networking"
+	"github.com/kahnwong/swissknife/cmd/get"
 	"github.com/kahnwong/swissknife/cmd/security"
 	"github.com/spf13/cobra"
 )
@@ -24,6 +24,6 @@ func Execute() {
 
 func init() {
 	rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
-	rootCmd.AddCommand(networking.Cmd)
+	rootCmd.AddCommand(get.Cmd)
 	rootCmd.AddCommand(security.Cmd)
 }