11package status
22
33import (
4- "encoding/json"
5- "fmt"
6-
74 "github.com/spf13/cobra"
8- "github.com/stackitcloud/stackit-cli/internal/cmd/params"
95 "github.com/stackitcloud/stackit-cli/internal/pkg/args"
106 "github.com/stackitcloud/stackit-cli/internal/pkg/auth"
117 "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
128 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
139 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
10+ "github.com/stackitcloud/stackit-cli/internal/pkg/types"
1411)
1512
1613type inputModel struct {
@@ -23,7 +20,7 @@ type statusOutput struct {
2320 AuthFlow string `json:"auth_flow,omitempty"`
2421}
2522
26- func NewCmd (params * params .CmdParams ) * cobra.Command {
23+ func NewCmd (p * types .CmdParams ) * cobra.Command {
2724 cmd := & cobra.Command {
2825 Use : "status" ,
2926 Short : "Shows authentication status for the STACKIT Terraform Provider and SDK" ,
@@ -35,7 +32,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
3532 "$ stackit auth api status" ),
3633 ),
3734 RunE : func (cmd * cobra.Command , args []string ) error {
38- model , err := parseInput (params .Printer , cmd , args )
35+ model , err := parseInput (p .Printer , cmd , args )
3936 if err != nil {
4037 return err
4138 }
@@ -44,7 +41,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
4441 accessToken , err := auth .GetAuthFieldWithContext (auth .StorageContextAPI , auth .ACCESS_TOKEN )
4542 if err != nil || accessToken == "" {
4643 // Not authenticated
47- return outputStatus (params .Printer , model , statusOutput {
44+ return outputStatus (p .Printer , model , statusOutput {
4845 Authenticated : false ,
4946 })
5047 }
@@ -56,7 +53,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
5653 email = ""
5754 }
5855
59- return outputStatus (params .Printer , model , statusOutput {
56+ return outputStatus (p .Printer , model , statusOutput {
6057 Authenticated : true ,
6158 Email : email ,
6259 AuthFlow : string (flow ),
@@ -66,7 +63,7 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
6663
6764 // hide project id flag from help command because it could mislead users
6865 cmd .SetHelpFunc (func (command * cobra.Command , strings []string ) {
69- _ = command .Flags ().MarkHidden (globalflags .ProjectIdFlag ) // nolint:errcheck // there's no chance to handle the error here
66+ cobra . CheckErr ( command .Flags ().MarkHidden (globalflags .ProjectIdFlag ))
7067 command .Parent ().HelpFunc ()(command , strings )
7168 })
7269
0 commit comments