Documentation ¶
Index ¶
- func CheckErr(err error)
- func ConvertStringToTypeOrDefault[T any](str string, defaultValue T) T
- func GetKernelVersion() (string, error)
- func GetOSRelease() (string, error)
- func GetPackageManagerType(osRelease string) (pkgmgr.PackageManagerType, error)
- func HandleResult(resultBytes []byte, outputFile string, logger *logrus.Entry) error
- func IsModuleLoaded(moduleName string) (bool, error)
- func SetFlagHidden(cmd *cobra.Command, option string)
- func SetGlobalOptionsLocal(cmd *cobra.Command, globalOpts *types.GlobalCmdOptions)
- func SetGlobalOptionsRemote(cmd *cobra.Command, globalOpts *types.GlobalCmdOptions)
- func SetLog(logLevel string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckErr ¶
func CheckErr(err error)
CheckErr logs the error and exits with a non-zero code. This is similar to cobra.CheckErr except that it prints with logrus.
func ConvertStringToTypeOrDefault ¶
ConvertStringToTypeOrDefault converts a string to the type of the default value. If string is empty, it will return the default value. If string is not empty, it will attempt to convert it to the type of the default value. If conversion fails, it will return the default value.
func GetKernelVersion ¶
func GetOSRelease ¶
func GetPackageManagerType ¶
func GetPackageManagerType(osRelease string) (pkgmgr.PackageManagerType, error)
func HandleResult ¶
func IsModuleLoaded ¶
func SetFlagHidden ¶
SetFlagHidden adds a option flag to the given command and mark it as hidden. This is useful for hiding flags that are not meant to be used or are not intended to be exposed to users via the command-line help menus.
func SetGlobalOptionsLocal ¶
func SetGlobalOptionsLocal(cmd *cobra.Command, globalOpts *types.GlobalCmdOptions)
SetGlobalOptionsLocal sets global options for local commands.
func SetGlobalOptionsRemote ¶
func SetGlobalOptionsRemote(cmd *cobra.Command, globalOpts *types.GlobalCmdOptions)
SetGlobalOptionsRemote sets global options for remote commands.
Types ¶
This section is empty.