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

Decide on when to provide a --help flag for bash scripts #16

Open
jotaen4tinypilot opened this issue Oct 20, 2023 · 2 comments
Open

Decide on when to provide a --help flag for bash scripts #16

jotaen4tinypilot opened this issue Oct 20, 2023 · 2 comments

Comments

@jotaen4tinypilot
Copy link
Contributor

Our bash scripts currently don’t follow a consistent pattern in regards to whether they provide a --help option. E.g.,

My suggestion would be:

  • If a bash script is supposed to be user-facing, then it should provide a --help flag.
  • If a bash script is for internal purposes (i.e., programmatic usage), it shouldn’t provide a --help flag.
    • For instance: all our privileged scripts.
    • However, a docstring comment at the top should then be mandatory.

The downside of providing a --help flag is the significant amount of boilerplate code it requires. To illustrate this: is-ssh-enabled has 24 LOC – only 6 of which are actual logic, and 18 are for processing the --help flag.

@mtlynch
Copy link
Contributor

mtlynch commented Oct 20, 2023

I agree. I like the proposed convention.

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

3 participants
@mtlynch @jotaen4tinypilot and others