Skip to content

Commit cff601b

Browse files
committed
refactor: remove version flags and update initialization for bugreport command
1 parent de15212 commit cff601b

File tree

2 files changed

+23
-73
lines changed

2 files changed

+23
-73
lines changed

cmd/nomos/version/flags.go

Lines changed: 0 additions & 46 deletions
This file was deleted.

cmd/nomos/version/version.go

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ import (
4141
)
4242

4343
func init() {
44-
// Initialize flags for the version command
44+
// Initialize flags for the bugreport command
4545
// This separation keeps flag definitions isolated from command execution logic
46-
globalFlags := NewVersionFlags()
47-
globalFlags.AddFlags(Cmd)
46+
flags.AddClientTimeout(Cmd)
4847
}
4948

5049
// GetVersionReadCloser returns a ReadCloser with the output produced by running the "nomos version" command as a string
@@ -65,34 +64,31 @@ func GetVersionReadCloser(ctx context.Context) (io.ReadCloser, error) {
6564
return io.NopCloser(r), nil
6665
}
6766

68-
var (
69-
// clientVersion is a function that obtains the local client version.
70-
clientVersion = func() string {
71-
return version.VERSION
72-
}
67+
var clientVersion = func() string {
68+
return version.VERSION
69+
}
7370

74-
// Cmd is the Cobra object representing the nomos version command.
75-
Cmd = &cobra.Command{
76-
Use: "version",
77-
Short: "Prints the version of ACM for each cluster as well this CLI",
78-
Long: `Prints the version of Configuration Management installed on each cluster and the version
71+
// Cmd is the Cobra object representing the nomos version command.
72+
var Cmd = &cobra.Command{
73+
Use: "version",
74+
Short: "Prints the version of ACM for each cluster as well this CLI",
75+
Long: `Prints the version of Configuration Management installed on each cluster and the version
7976
of the "nomos" client binary for debugging purposes.`,
80-
Example: ` nomos version`,
81-
RunE: func(cmd *cobra.Command, _ []string) error {
82-
// Don't show usage on error, as argument validation passed.
83-
cmd.SilenceUsage = true
77+
Example: ` nomos version`,
78+
RunE: func(cmd *cobra.Command, _ []string) error {
79+
// Don't show usage on error, as argument validation passed.
80+
cmd.SilenceUsage = true
8481

85-
// Create execution parameters from parsed flags
86-
params := ExecParams{
87-
Contexts: flags.Contexts,
88-
ClientTimeout: flags.ClientTimeout,
89-
}
82+
// Create execution parameters from parsed flags
83+
params := ExecParams{
84+
Contexts: flags.Contexts,
85+
ClientTimeout: flags.ClientTimeout,
86+
}
9087

91-
// Execute the version command logic
92-
return ExecuteVersion(cmd.Context(), params)
93-
},
94-
}
95-
)
88+
// Execute the version command logic
89+
return ExecuteVersion(cmd.Context(), params)
90+
},
91+
}
9692

9793
// allKubectlConfigs gets all kubectl configs, with error handling
9894
// This function is maintained for backward compatibility with existing code

0 commit comments

Comments
 (0)