project8 / dripline

Slow controls for medium scale physics experiments based on AMQP centralized messaging
http://www.project8.org/dripline
1 stars 0 forks source link

end the proliferation of command line tools #99

Closed laroque closed 8 years ago

laroque commented 9 years ago

There has been a silly proliferation of command line tools within dripline. It made sense at the time, but looking now...

There should be one dripline command with a reasonable number of subcommands (a la git commit and git log etc...) which covers the things one may want to do. A 'cli_util' directory or similar, parallel to core and instruments, should contain the *.py files which are essentially the existing programs as well as the untility files currently in core or elsewhere. To whatever extent they are not already, their behavior should be encapsulated in a class or function and a parser object made available either for external import or returnable from some exported get_parser() function. The one executable, would then add subcommands to its own master parser for each of them (this provides a good handle for activating/deactivating features for which dependencies are or are not met)....

Make the config file parser more generic

Many of the tools (sensor logger, pid_loop, etc. are almost always evoked with a bunch of flags which could just as well be specified in a config file). This would be nicer since it can be version controlled in the software_config directory and doesn't depend on bash_history not being lost. This involves updating the behavior of the config file parser.

Extra features that would be nice

  1. a dependencies_met() function that tries the required imports for a particular subcommand and returns a bool indicating if requirements are met. The implementation of dripline (the exe) could then test on this before adding subcommands to the arg_parser.
  2. the help for dripline should, ideally, list all of the subcommands and mark as "unmet dependencies" those which are not available. That way a user can use the help to know about features that exist but are not currently active, and why.... If I were cleaver, I'd figure out how to do this using the actual plug-in system for setup.py, since that's probably what it is for.

    References

See https://docs.python.org/2/library/argparse.html#action section 15.4.5.1

laroque commented 8 years ago

solved in dragonfly