refactor: consolidate packages - move output to cmd, config/session to store, rename Store to GraphStore
This commit is contained in:
+5
-6
@@ -1,8 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"axolotl/output"
|
||||
"axolotl/service"
|
||||
"axolotl/store"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
@@ -17,7 +16,7 @@ var aliasCmd = &cobra.Command{
|
||||
w := cmd.OutOrStdout()
|
||||
if len(args) == 0 {
|
||||
if aliases, err := cfg.ListAliases(); err == nil {
|
||||
output.PrintAliases(w, aliases, jsonFlag)
|
||||
PrintAliases(w, aliases, jsonFlag)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -30,10 +29,10 @@ var aliasCmd = &cobra.Command{
|
||||
fmt.Println(a.Command)
|
||||
return
|
||||
}
|
||||
if err := cfg.SetAlias(&service.Alias{Name: args[0], Command: args[1], Description: aliasDesc}); err != nil {
|
||||
if err := cfg.SetAlias(&store.Alias{Name: args[0], Command: args[1], Description: aliasDesc}); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "failed to set alias:", err)
|
||||
} else {
|
||||
output.PrintAction(w, "Alias set", args[0], false)
|
||||
PrintAction(w, "Alias set", args[0], false)
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -45,7 +44,7 @@ var aliasDelCmd = &cobra.Command{
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
output.PrintAction(cmd.OutOrStdout(), "Alias deleted", args[0], false)
|
||||
PrintAction(cmd.OutOrStdout(), "Alias deleted", args[0], false)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user