mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor(cmd): reformat the command to match other commands
This commit is contained in:
+15
-1
@@ -4,13 +4,17 @@ Copyright © 2025 NAME HERE <EMAIL ADDRESS>
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/Slug-Boi/cocommit/src/cmd/tui"
|
||||
"github.com/Slug-Boi/cocommit/src/cmd/utils"
|
||||
//"github.com/charmbracelet/lipgloss"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// ghProfileCmd represents the ghProfile command
|
||||
var ghCmd = &cobra.Command{
|
||||
func GHCmd () *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "gh <github username>",
|
||||
Short: "This command will create add a github profile to your author list for use in commits",
|
||||
Long: `This command will create add a github profile to your author list.
|
||||
@@ -46,14 +50,24 @@ var ghCmd = &cobra.Command{
|
||||
|
||||
if email != "" {
|
||||
user.Email = email
|
||||
if utils.CheckUserFields(user) {
|
||||
utils.CreateAuthor(user)
|
||||
// print sucess message
|
||||
//fmt.Print(lipgloss.NewStyle().Foreground(lipgloss.Color("170")).Render("Author added successfully"))
|
||||
fmt.Print("Author added successfully\n")
|
||||
} else {
|
||||
panic("Invalid author data")
|
||||
}
|
||||
} else {
|
||||
// run the TUI to get the email
|
||||
tui.EntryGHAuthorModel(user)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
ghCmd := GHCmd()
|
||||
rootCmd.AddCommand(ghCmd)
|
||||
ghCmd.Flags().StringP("email", "@", "", "Email to be used for the author")
|
||||
ghCmd.Flags().StringP("longname", "n", "", "Name to be used for the author")
|
||||
|
||||
Reference in New Issue
Block a user