diff --git a/cmd/auth.go b/cmd/auth.go index 4dcf6b2..78be616 100644 --- a/cmd/auth.go +++ b/cmd/auth.go @@ -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) @@ -55,3 +62,11 @@ func init() { fmt.Printf("Expires In: %d\n", response.ExpiresIn) } } + +// ---------------------------------------------- +// initialize +// ---------------------------------------------- + +func init() { + rootCmd.AddCommand(authCmd) +}