materialsproject / fireworks

The Fireworks Workflow Management Repo.
https://materialsproject.github.io/fireworks
Other
361 stars 185 forks source link

Filter list of possible lpad commands on bad user input #458

Open janosh opened 3 years ago

janosh commented 3 years ago

Running lpad fizzle_wflows -s RUNNING raises

lpad: error: argument command: invalid choice: 'fizzle_wflows' (choose from 'version', 'init', 'reset', 'add', 'check_wflow', 'get_launchdir', 'append_wflow', 'dump_wflow', 'add_scripts', 'get_fws', 'get_fws_in_wflows', 'track_fws', 'rerun_fws', 'defuse_fws', 'pause_fws', 'reignite_fws', 'resume_fws', 'update_fws', 'get_wflows', 'defuse_wflows', 'pause_wflows', 'reignite_wflows', 'archive_wflows', 'delete_wflows', 'get_qids', 'cancel_qid', 'detect_unreserved', 'detect_lostruns', 'set_priority', 'webgui', 'recover_offline', 'forget_offline', 'admin', 'report', 'introspect')

since it should have been lpad defuse_wflows -s RUNNING.

Suggestion for a small QoL improvement: Instead of presenting the user with the whole list of possible commands, it's probably safe to assume they want to modify fireworks/workflows if the command they wrote contains _wfs/_wflows. In that case, only suggest the relevant commands, i.e. in this case

lpad: error: argument command: invalid choice: 'fizzle_wflows' (choose from 'get_fws_in_wflows', 'get_wflows', 'defuse_wflows', 'pause_wflows', 'reignite_wflows', 'archive_wflows', 'delete_wflows')