Skip to content

Bash/script help should align lists into columns for easier reading #246

@ascarter

Description

@ascarter

Compared to the help output for the Rust apps, the bash help isn't as nice. In particular, would be good if the lists would align:

Examples:

% ./example.sh -h
Usage: ex [FLAGS] [baz]

Arguments:
  [baz]  Positional values

Flags:
  --foo  Flag value
  --bar <bar>  Option value
  --defaulted <defaulted>  Defaulted value

The flags list should have the descriptions aligned like they are when using CLI in Rust

% ./mounted.sh -h
Usage: ex [--mount] <SUBCOMMAND>

Commands:
  exec-task
  help  Print this message or the help of the given subcommand(s)

Flags:
  --mount  Display kdl spec for mounted tasks

Commands should also be aligned

My own dotfiles helper script that I added some usage comments to:

% dotfiles -h
Manage dotfiles


Usage: dotfiles [FLAGS] <SUBCOMMAND>

Commands:
  adopt  Add changed configuration files to dotfiles
  init  Initialize dotfiles
  list  Show configuration status
  unlink  Unlink configuration
  update  Update configuration
  help  Print this message or the help of the given subcommand(s)

Flags:
  -d --directory <DIR>  dotfiles directory
  -t --target <DIR>  Target directory
  -v --verbose  Verbose

The commands and flags would be much easier to read if these were aligned.

Bonus if each section was bold like it also is in Rust.

I took a look but I didn't see where the bash help comes from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions