Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/nfd/subcmd/compat/validate-node.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ var (
username string
password string
accessToken string

validateExample = `
# Validate image compatibility
nfd compat validate-node --image <image-url>`
)

var validateNodeCmd = &cobra.Command{
Use: "validate-node",
Short: "Perform node validation based on its associated image compatibility artifact",
Use: "validate-node",
Short: "Perform node validation based on its associated image compatibility artifact",
Example: validateExample,
PreRunE: func(cmd *cobra.Command, args []string) error {
var err error

Expand Down
16 changes: 13 additions & 3 deletions cmd/nfd/subcmd/export/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ import (
"sigs.k8s.io/node-feature-discovery/source"
)

var (
exportFeaturesExample = `
# Export node features to stdout (prints to terminal)
nfd export features

# Export node features to a file instead
nfd export features --path /tmp/features.json`
)

func NewExportCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "features",
Short: "Export features for given node",
Use: "features",
Short: "Export features for given node",
Example: exportFeaturesExample,
RunE: func(cmd *cobra.Command, args []string) error {
sources := map[string]source.FeatureSource{}
for k, v := range source.GetAllFeatureSources() {
Expand Down Expand Up @@ -59,7 +69,7 @@ func NewExportCmd() *cobra.Command {
return err
},
}
cmd.Flags().StringVar(&outputPath, "path", "", "export to this JSON path")
cmd.Flags().StringVarP(&outputPath, "path", "p", "", "export to this JSON path")
return cmd
}

Expand Down
16 changes: 13 additions & 3 deletions cmd/nfd/subcmd/export/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,20 @@ import (
"sigs.k8s.io/node-feature-discovery/source"
)

var (
exportLabelsExample = `
# Export node labels to stdout (prints to terminal)
nfd export features

# Export node labels to a file instead
nfd export features --path /tmp/labels.json`
)

func NewLabelsCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "labels",
Short: "Export feature labels for given node",
Use: "labels",
Short: "Export feature labels for given node",
Example: exportLabelsExample,
RunE: func(cmd *cobra.Command, args []string) error {

// Determine enabled feature sources
Expand Down Expand Up @@ -93,7 +103,7 @@ func NewLabelsCmd() *cobra.Command {
return err
},
}
cmd.Flags().StringVar(&outputPath, "path", "", "export to this JSON path")
cmd.Flags().StringVarP(&outputPath, "path", "p", "", "export to this JSON path")
return cmd
}

Expand Down
1 change: 1 addition & 0 deletions cmd/nfd/subcmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var RootCmd = &cobra.Command{
func init() {
RootCmd.AddCommand(compat.CompatCmd)
RootCmd.AddCommand(export.ExportCmd)
RootCmd.SilenceUsage = true
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down