Opened 8 years ago
Last modified 7 years ago
#943 assigned enhancement
RFE: show defaults in command usage
Reported by: | Elaine Meng | Owned by: | Greg Couch |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Command Line | Version: | |
Keywords: | Cc: | chimera-programmers | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
Seems like it would be useful if the "usage" information in the Log included the default values of options, even just for the boolean options if that's more feasible than for all kinds of options.
Note:
See TracTickets
for help on using tickets.
One potential way to do this is to use Python's introspection capability to look at a function's default argument values. This has the advantage that the default value is only specified in one place. However, this does not capture the right default for functions that choose a default programmatically.
Another way would be to add the default value to the argument annotation, which, if a string, would allow for a description of the default. For example, the turn command has a 'center' keyword argument which defaults to the current center of rotation. Using Python's function introspection the value would be None, which would not help the user.
So perhaps a hybrid solution is in order. If an argument is a 'primitive' type, then we could use Python's introspection to get the default, otherwise a description would be expected. A description would also be expected whenever the defaults is None.