tiny-pilot / style-guides

Style guides for TinyPilot coding conventions
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

Backport example of passing through command-line flags #19

Closed mtlynch closed 5 months ago

mtlynch commented 5 months ago

In https://github.com/tiny-pilot/tinypilot/pull/1768, we added a way to parse some flags in our bash script and then pass the remaining flags to a subprocess we call at the end of the script.

We should document this as the standard way of performing this so that we don't have to reinvent the wheel in the future.

jotaen4tinypilot commented 5 months ago

Adding to this, I think we could also consider updating our documentation regarding the following points:

mtlynch commented 5 months ago

@jotaen4tinypilot - Can you create those as separate bugs? I want to keep each bug tightly scoped so that we don't end up ballooning up scope when we try to improve the style guides.

We could consider switching from while [[ "$#" -gt 0 ]]; do to while (( "$#" > 0 )); do for parsing flags.

This one is small enough that it can just be a direct PR.

Actually, if any of them are less than 2 hours, you can just submit them as direct PRs if you feel inclined.

jotaen4tinypilot commented 5 months ago

I think the --help topic would warrant it’s own ticket, also to give appropriate room for discussion if need be.

The 2 points (( "$#" > 0 )) and “positional vs flags” I’ve noted on my todo list, and will do them on the side in the next days.