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

Command line argument naming should follow UNIX conventions #978

Open
mjuric opened this issue Jul 12, 2024 · 3 comments
Open

Command line argument naming should follow UNIX conventions #978

mjuric opened this issue Jul 12, 2024 · 3 comments
Assignees

Comments

@mjuric
Copy link
Member

mjuric commented Jul 12, 2024

Unix programs these days typically follow the GNU conventions for command line arguments. We deviate from them in two ways:

  • Have short arguments with more than one character (e.g. -cp in sorcha run). This is ambiguous with shortening -c -p as -cp (see the second bullet here), and makes argparse disable this feature entirely.
  • Have long arguments with underscores (_). This goes against GNU conventions (quote: "Long options consist of -- followed by a name made of alphanumeric characters and dashes."), but more importantly it makes our code feel a bit unnatural (very Java-ish). E.g., run git add --help or ls --help (on linux) to see the difference.

I propose we fix this now, before the cmdline API is frozen for v1.0 -- it will be very hard (impossible) to change later. The fix is easy (I'm volunteering to do it).

image
@mjuric
Copy link
Member Author

mjuric commented Jul 12, 2024

Current WIP prototype (early comments welcome):
image

@mschwamb
Copy link
Collaborator

command line argument --help needs to show what parameters are required and which are optional

@astronomerritt
Copy link
Collaborator

After some discussion, we'd be happy to implement these changes to the command line arguments -- and only these, in a single dedicated PR -- with the following changes:

  • Arguments should be organised into optional and non-optional, as they are now.
  • I don't think there should be any defaults for the non-optional arguments. At the moment, there are default file names showing for the input file arguments.
  • We're not using --colors. --physical-parameters please. It matches with --complex-physical-parameters.
  • Likewise change the description of that argument to "Catalog of object physical parameters".
  • The description of --complex-physical-parameters should be "Catalog of object complex physical parameters."
  • The description of --verbose should specify "Print additional information to log while running"

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