Closed
Description
Small amounts of refactoring can be done to all files under cmd
which have additional flags.
Creating const
types for default values of flags.
-
Each flag in cobra needs to have a default value set. As of now the default value in some cases is mentioned while creating the flag such as
Line 106 in 03a9809
-
For increased readability and also maintainability, it would be better to have a
const
of these default values like this:
const (
DefaultProcRefreshRate = 3000
)
Splitting flag initialization to multiple lines
A flag initialization such as:
procCmd.Flags().Int32P("refresh", "r", DefaultProcRefreshRate, "Process information UI refreshes rate in milliseconds greater than 1000")
could be re-written to:
procCmd.Flags().Int32P(
"refresh",
"r",
DefaultProcRefreshRate,
"Process information UI refreshes rate in milliseconds greater than 1000",
)