jdx / jdx/usage

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

Open
#246 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1k
Forks
59
Avg merge
5h 58m
Merged PRs (30d)
362

Description

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:

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

Arguments:
[baz] Positional values

Flags:
--foo Flag value
--bar Option value
--defaulted Defaulted value
```

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

```sh
% ./mounted.sh -h
Usage: ex [--mount]

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:

```sh
% dotfiles -h
Manage dotfiles

Usage: dotfiles [FLAGS]

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 dotfiles directory
-t --target 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.