Commit 3c855cf

Karn Wong <[email protected]>
2025-04-15 07:46:51
refactor: rename listVolumes to getVolumes
1 parent ea94d45
cmd/list/list_volumes.go → cmd/get/get_volumes.go
@@ -1,4 +1,4 @@
-package list
+package get
 
 import (
 	"fmt"
cmd/list/list.go
@@ -1,23 +0,0 @@
-package list
-
-import (
-	"os"
-
-	"github.com/rs/zerolog/log"
-
-	"github.com/spf13/cobra"
-)
-
-var Cmd = &cobra.Command{
-	Use:   "list",
-	Short: "List devices and volumes",
-	Run: func(cmd *cobra.Command, args []string) {
-		if len(args) == 0 {
-			err := cmd.Help()
-			if err != nil {
-				log.Fatal().Msg("Failed to display help")
-			}
-			os.Exit(0)
-		}
-	},
-}
cmd/root.go
@@ -5,7 +5,6 @@ import (
 
 	"github.com/kahnwong/swissknife/cmd/generate"
 	"github.com/kahnwong/swissknife/cmd/get"
-	"github.com/kahnwong/swissknife/cmd/list"
 	"github.com/spf13/cobra"
 )
 
@@ -30,5 +29,4 @@ func Execute() {
 func init() {
 	rootCmd.AddCommand(get.Cmd)
 	rootCmd.AddCommand(generate.Cmd)
-	rootCmd.AddCommand(list.Cmd)
 }
utils/clipboard.go
@@ -26,7 +26,12 @@ func WriteToClipboardImage(bytes []byte) {
 	if err != nil {
 		log.Fatal().Msg("Failed to open temp image for clipboard")
 	}
-	defer f.Close()
+	defer func(f *os.File) {
+		err := f.Close()
+		if err != nil {
+			log.Error().Msg("Error opening temp image for clipboard")
+		}
+	}(f)
 
 	if err = clipboardImage.CopyToClipboard(f); err != nil {
 		log.Fatal().Msg("Failed to copy to clipboard")
README.md
@@ -30,7 +30,6 @@ Available Commands:
   generate           Generate stuff
   get                Obtain information
   help               Help about any command
-  list               List devices and volumes
   shouldideploytoday Should I deploy today?
   speedtest          Speedtest
   stopwatch          Create a stopwatch