Skip to content

Commit d432d1d

Browse files
authored
Move gitconfig over to git, section commands (#60)
1 parent c865f95 commit d432d1d

4 files changed

Lines changed: 17 additions & 25 deletions

File tree

cmd/git/git.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

cmd/root.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/major-technology/cli/clients/config"
1010
mjrToken "github.com/major-technology/cli/clients/token"
1111
"github.com/major-technology/cli/cmd/app"
12-
"github.com/major-technology/cli/cmd/git"
1312
"github.com/major-technology/cli/cmd/org"
1413
"github.com/major-technology/cli/cmd/resource"
1514
"github.com/major-technology/cli/cmd/user"
@@ -90,11 +89,20 @@ func init() {
9089
})
9190

9291
// Register subcommands
92+
rootCmd.AddGroup(&cobra.Group{ID: "main", Title: "Main Commands"})
93+
rootCmd.AddGroup(&cobra.Group{ID: "config", Title: "Configurations"})
94+
95+
user.Cmd.GroupID = "config"
9396
rootCmd.AddCommand(user.Cmd)
97+
98+
org.Cmd.GroupID = "config"
9499
rootCmd.AddCommand(org.Cmd)
100+
101+
app.Cmd.GroupID = "main"
95102
rootCmd.AddCommand(app.Cmd)
103+
104+
resource.Cmd.GroupID = "main"
96105
rootCmd.AddCommand(resource.Cmd)
97-
rootCmd.AddCommand(git.GitCmd)
98106
}
99107

100108
func initConfig() {
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package git
1+
package user
22

33
import (
44
"github.com/charmbracelet/huh"
@@ -8,17 +8,17 @@ import (
88
"github.com/spf13/cobra"
99
)
1010

11-
// configCmd represents the git config command
12-
var configCmd = &cobra.Command{
13-
Use: "config",
11+
// gitconfigCmd represents the gitconfig command
12+
var gitconfigCmd = &cobra.Command{
13+
Use: "gitconfig",
1414
Short: "Configure git settings",
1515
Long: `Configure git-related settings such as your GitHub username.`,
1616
RunE: func(cobraCmd *cobra.Command, args []string) error {
17-
return runConfig(cobraCmd)
17+
return runGitConfig(cobraCmd)
1818
},
1919
}
2020

21-
func runConfig(cobraCmd *cobra.Command) error {
21+
func runGitConfig(cobraCmd *cobra.Command) error {
2222
// Get current GitHub username if it exists
2323
currentUsername, err := mjrToken.GetGithubUsername()
2424
if err != nil {

cmd/user/user.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ func init() {
2424
Cmd.AddCommand(loginCmd)
2525
Cmd.AddCommand(logoutCmd)
2626
Cmd.AddCommand(whoamiCmd)
27+
Cmd.AddCommand(gitconfigCmd)
2728
}

0 commit comments

Comments
 (0)