refactor: remove init functions from command files

Amolith and Crush created

Co-authored-by: Crush <crush@charm.land>

Change summary

cmd/a.go |  4 ----
cmd/m.go |  4 ----
cmd/p.go |  4 ----
cmd/r.go | 14 --------------
cmd/s.go |  4 ----
5 files changed, 30 deletions(-)

Detailed changes

cmd/a.go 🔗

@@ -18,10 +18,6 @@ var aCmd = &cobra.Command{
 	RunE:  runArchiveSession,
 }
 
-func init() {
-	rootCmd.AddCommand(aCmd)
-}
-
 func runArchiveSession(cmd *cobra.Command, args []string) error {
 	env, err := shared.Environment(cmd)
 	if err != nil {

cmd/m.go 🔗

@@ -25,7 +25,3 @@ recent (top) to least recent (bottom).`,
 		fmt.Println("[STUB] Launch interactive TUI to monitor session events in real-time")
 	},
 }
-
-func init() {
-	rootCmd.AddCommand(mCmd)
-}

cmd/p.go 🔗

@@ -16,10 +16,6 @@ var pCmd = &cobra.Command{
 	RunE:  runPrintPlan,
 }
 
-func init() {
-	rootCmd.AddCommand(pCmd)
-}
-
 func runPrintPlan(cmd *cobra.Command, args []string) error {
 	env, err := shared.Environment(cmd)
 	if err != nil {

cmd/r.go 🔗

@@ -18,17 +18,3 @@ var rCmd = &cobra.Command{
 		fmt.Println("[STUB] Resume interrupted session from database")
 	},
 }
-
-func init() {
-	rootCmd.AddCommand(rCmd)
-
-	// Here you will define your flags and configuration settings.
-
-	// Cobra supports Persistent Flags which will work for this command
-	// and all subcommands, e.g.:
-	// rCmd.PersistentFlags().String("foo", "", "A help for foo")
-
-	// Cobra supports local flags which will only run when this command
-	// is called directly, e.g.:
-	// rCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
-}

cmd/s.go 🔗

@@ -20,10 +20,6 @@ var sCmd = &cobra.Command{
 	RunE:  runStartSession,
 }
 
-func init() {
-	rootCmd.AddCommand(sCmd)
-}
-
 func runStartSession(cmd *cobra.Command, args []string) error {
 	env, err := requireEnvironment()
 	if err != nil {