mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:56:45 +08:00
initialize file structure
This commit is contained in:
commit
2b5c0dddc4
8 files changed
+154
No files matched your search
@@ -0,0 +1,45 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// COMMAND LINE INTERFACE GOES HERE
|
||||
func init() {
|
||||
rootCmd.AddCommand(switchCmd)
|
||||
switchCmd.AddCommand(switchBranchCmd)
|
||||
switchCmd.AddCommand(switchAccountCmd)
|
||||
}
|
||||
|
||||
var switchCmd = &cobra.Command{
|
||||
Use: "switch",
|
||||
Short: "Switch context, branches, or accounts",
|
||||
}
|
||||
|
||||
var switchBranchCmd = &cobra.Command{
|
||||
Use: "branch [name]",
|
||||
Short: "Switch to a specific branch",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
performBranchSwitch(args[0])
|
||||
},
|
||||
}
|
||||
|
||||
var switchAccountCmd = &cobra.Command{
|
||||
Use: "account [username]",
|
||||
Short: "Switch to a specific user account",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
performAccountSwitch(args[0])
|
||||
},
|
||||
}
|
||||
|
||||
// PERFORMERS GO HERE
|
||||
func performAccountSwitch(username string) {
|
||||
fmt.Printf("Switched to account: %s\n", username)
|
||||
}
|
||||
|
||||
func performBranchSwitch(branchName string) {
|
||||
fmt.Printf("Switched to branch: %s\n", branchName)
|
||||
}
|
||||
Reference in new issue
Block a user