Skip to content

show help messages when sub-command is run without required arguments #185

@viveksahu26

Description

@viveksahu26

Title:
Improve CLI UX: Show help text when sub-command is run without required arguments

Description:
Currently, when subcommands like edit are run without the required arguments, the CLI only displays a error like:

$ sbomasm edit
Error: accepts 1 arg(s), received 0

To help user with the command structure, we should automatically provide the help messages.

Desired Proposal

Update CLI behavior to automatically show help text when:

  • A subcommand is invoked without required arguments
  • -h or --help is passed
  • No flags or args are provided after a subcommand
$ sbomasm edit
Error: requires at least 1 argument

Usage:
  sbomasm edit [flags]

Flags:
  -a, --append               append to field instead of replacing
      --author strings       author to add e.g 'name (email)'
      --copyright string     copyright to add e.g 'Copyright © 2024'
      --cpe string           cpe to add e.g 'cpe:2.3:a:microsoft:internet_explorer:8.*:sp?:*:*:*:*:*:*'
      --description string   description to add e.g 'this is a cool app'
      --hash strings         checksum to add e.g 'MD5 (hash'
  -h, --help                 help for edit
      --license strings      license to add e.g 'MIT'
      --lifecycle strings    lifecycle to add e.g 'build'
  -m, --missing              edit only missing fields
      --name string          name of the entity
  -o, --output string        path to edited sbom, defaults to stdout
      --purl string          purl to add e.g 'pkg:deb/debian/abc@1.0.0'
      --repository string    repository to add e.g 'github.com/interlynk-io/sbomasm'
      --search string        search string to find the entity
      --subject string       subject to edit (document, primary-component, component-name-version) (default "document")
      --supplier string      supplier to add e.g 'name (email)'
      --timestamp            add created-at timestamp
      --tool strings         tool to add e.g 'sbomasm (v1.0.0)'
      --type string          type to add e.g 'application'
      --version string       version of the entity

Global Flags:
  -d, --debug   debug output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions