Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/verify-documented-usage.sh is not environment agnostic #852

Open
Xophmeister opened this issue Jan 28, 2025 · 1 comment
Open

bin/verify-documented-usage.sh is not environment agnostic #852

Xophmeister opened this issue Jan 28, 2025 · 1 comment

Comments

@Xophmeister
Copy link
Member

Describe the bug
The bin/verify-documented-usage.sh script checks that the usage documentation in the README matches the various Topiary CLI subcommand --help outputs. However, it does not account for line wrapping in the --help outputs, which appear to be environment-dependent. (My suspicion is the TTY of the process, if there is one.)

This leads to false negatives.

To Reproduce
In the nix develop dev-shell, run verify-documented-usage. It will probably complain that the README is out-of-sync with at least one of the subcommands' --help output. (If not, resize your terminal until it does!)

Expected behaviour
The output produced by the script should be wrapped at a set width (80 columns, say), so it's deterministic.

Environment

  • OS name + version: NixOS 24.11
  • Version of the code: d61664f
@Xophmeister
Copy link
Member Author

#854 was an abortive attempt to solve this:

  • Naively setting $COLUMNS doesn't do anything.
  • Using stty to set the terminal width doesn't work because the CI doesn't run in a TTY.
  • Using clap::Command::max_term_width didn't work as expected and, even if it did, it's not a satisfactory solution.

I believe the way to do this is to create a pseudoterminal, with a set size, then run the --help commands in that. This cannot be done in a simple Bash script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant