Skip to content

Commit

Permalink
refactor command source into function
Browse files Browse the repository at this point in the history
add comment blocks
  • Loading branch information
doneill committed Nov 20, 2023
1 parent ede26c5 commit 64bbf25
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@ import (
"github.com/spf13/cobra"
)

// authCmd represents the auth command
// ----------------------------------------------
// auth command
// ----------------------------------------------

var authCmd = &cobra.Command{
Use: "auth",
Short: "Authentication with EarthRanger",
Long: `Authenticate er with EarthRanger`,
Run: func(cmd *cobra.Command, args []string) {},
Run: func(cmd *cobra.Command, args []string) {
auth()
},
}

func init() {
rootCmd.AddCommand(authCmd)
// ----------------------------------------------
// funtions
// ----------------------------------------------

func auth() {
fmt.Println("Enter sitename:")
var sitename string
_, err := fmt.Scan(&sitename)
Expand Down Expand Up @@ -55,3 +62,11 @@ func init() {
fmt.Printf("Expires In: %d\n", response.ExpiresIn)
}
}

// ----------------------------------------------
// initialize
// ----------------------------------------------

func init() {
rootCmd.AddCommand(authCmd)
}

0 comments on commit 64bbf25

Please sign in to comment.