Skip to content

Commit ede5b1d

Browse files
committed
feat: Remove --details flag from server describe
1 parent 2696abb commit ede5b1d

File tree

3 files changed

+4
-43
lines changed

3 files changed

+4
-43
lines changed

docs/stackit_beta_server_describe.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,14 @@ stackit beta server describe [flags]
1616
Show details of a server with ID "xxx"
1717
$ stackit beta server describe xxx
1818
19-
Show detailed information of a server with ID "xxx"
20-
$ stackit beta server describe xxx --details
21-
2219
Show details of a server with ID "xxx" in JSON format
2320
$ stackit beta server describe xxx --output-format json
2421
```
2522

2623
### Options
2724

2825
```
29-
--details Show detailed information about server
30-
-h, --help Help for "stackit beta server describe"
26+
-h, --help Help for "stackit beta server describe"
3127
```
3228

3329
### Options inherited from parent commands

internal/cmd/beta/server/describe/describe.go

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
1212
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
1313
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
14-
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1514
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1615
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1716
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
@@ -24,13 +23,11 @@ import (
2423

2524
const (
2625
serverIdArg = "SERVER_ID"
27-
detailsFlag = "details"
2826
)
2927

3028
type inputModel struct {
3129
*globalflags.GlobalFlagModel
3230
ServerId string
33-
Details bool
3431
}
3532

3633
func NewCmd(p *print.Printer) *cobra.Command {
@@ -44,10 +41,6 @@ func NewCmd(p *print.Printer) *cobra.Command {
4441
`Show details of a server with ID "xxx"`,
4542
"$ stackit beta server describe xxx",
4643
),
47-
examples.NewExample(
48-
`Show detailed information of a server with ID "xxx"`,
49-
"$ stackit beta server describe xxx --details",
50-
),
5144
examples.NewExample(
5245
`Show details of a server with ID "xxx" in JSON format`,
5346
"$ stackit beta server describe xxx --output-format json",
@@ -76,14 +69,9 @@ func NewCmd(p *print.Printer) *cobra.Command {
7669
return outputResult(p, model, resp)
7770
},
7871
}
79-
configureFlags(cmd)
8072
return cmd
8173
}
8274

83-
func configureFlags(cmd *cobra.Command) {
84-
cmd.Flags().Bool(detailsFlag, false, "Show detailed information about server")
85-
}
86-
8775
func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inputModel, error) {
8876
serverId := inputArgs[0]
8977

@@ -95,7 +83,6 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
9583
model := inputModel{
9684
GlobalFlagModel: globalFlags,
9785
ServerId: serverId,
98-
Details: flags.FlagToBoolValue(p, cmd, detailsFlag),
9986
}
10087

10188
if p.IsVerbosityDebug() {
@@ -112,10 +99,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
11299

113100
func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APIClient) iaas.ApiGetServerRequest {
114101
req := apiClient.GetServer(ctx, model.ProjectId, model.ServerId)
115-
116-
if model.Details {
117-
req = req.Details(true)
118-
}
102+
req = req.Details(true)
119103

120104
return req
121105
}
@@ -142,9 +126,8 @@ func outputResult(p *print.Printer, model *inputModel, server *iaas.Server) erro
142126
return nil
143127
default:
144128
table := tables.NewTable()
145-
if model.Details {
146-
table.SetTitle("Server")
147-
}
129+
table.SetTitle("Server")
130+
148131
table.AddRow("ID", *server.Id)
149132
table.AddSeparator()
150133
table.AddRow("NAME", *server.Name)
@@ -204,11 +187,6 @@ func outputResult(p *print.Printer, model *inputModel, server *iaas.Server) erro
204187
return fmt.Errorf("render table: %w", err)
205188
}
206189

207-
// If no --details is set, we only display the overview table
208-
if !model.Details {
209-
return nil
210-
}
211-
212190
if server.Nics != nil && len(*server.Nics) > 0 {
213191
nicsTable := tables.NewTable()
214192
nicsTable.SetTitle("Attached Network Interfaces")

internal/cmd/beta/server/describe/describe_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func fixtureArgValues(mods ...func(argValues []string)) []string {
3535
func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string {
3636
flagValues := map[string]string{
3737
projectIdFlag: testProjectId,
38-
detailsFlag: "true",
3938
}
4039
for _, mod := range mods {
4140
mod(flagValues)
@@ -50,7 +49,6 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
5049
Verbosity: globalflags.VerbosityDefault,
5150
},
5251
ServerId: testServerId,
53-
Details: true,
5452
}
5553
for _, mod := range mods {
5654
mod(model)
@@ -136,17 +134,6 @@ func TestParseInput(t *testing.T) {
136134
flagValues: fixtureFlagValues(),
137135
isValid: false,
138136
},
139-
{
140-
description: "details flag false",
141-
argValues: fixtureArgValues(),
142-
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
143-
flagValues[detailsFlag] = "false"
144-
}),
145-
isValid: true,
146-
expectedModel: fixtureInputModel(func(model *inputModel) {
147-
model.Details = false
148-
}),
149-
},
150137
}
151138

152139
for _, tt := range tests {

0 commit comments

Comments
 (0)