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

For crates with binaries, allow writing of --help docs to README #93

Open
clbarnes opened this issue Dec 8, 2023 · 0 comments
Open

Comments

@clbarnes
Copy link

clbarnes commented Dec 8, 2023

Possibly best supported in the template file, something like

# {{crate}}

{{readme}}

## Binaries

### `my_bin_name`

{{bin:my_bin_name --help}}

### `my_other_bin`

{{bin:my_other_bin -h}}

which would produce something like

# my_crate

Some information I've totally written in my crate docs.

## Binaries

### `my_bin_name`

```
usage: my_bin_name [-h] arg [arg ...]

positional arguments:
  arg

options:
  -h, --help            show this help message and exit
```

### `my_other_bin`

```
usage: my_other_bin [-h] arg [arg ...]

positional arguments:
  arg

options:
  -h, --help            show this help message and exit
```

This would allow somewhat-arbitrary code execution which isn't ideal but this is a really useful feature to have when it comes to self-documentation. My current solution is a python script which pipes text into a labelled code block: https://pypi.org/project/pipe2codeblock/

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

No branches or pull requests

1 participant