WayScience / CytoSnake

Orchestrating high-dimensional cell morphology data processing pipelines
https://cytosnake.readthedocs.io
Creative Commons Attribution 4.0 International
3 stars 3 forks source link

Add auto complete support to CLI #36

Open axiomcura opened 1 year ago

axiomcura commented 1 year ago

Since cytosnake is a CLI tool that will house a multitude of workflows, it would be ideal to implement auto-tab completion for workflow names.

This will make it easier for user to find which workflow they would like to use instead of spelling the whole workflow name out.

There is a nice package called argcomplete that works really well with python's argparser module.

Here is an example:

import argparse
import argcomplete

parser = argparse.ArgumentParser(description='My program')

# Add your arguments as usual
parser.add_argument('--foo', help='foo help')
parser.add_argument('--bar', help='bar help')

# Call argcomplete.autocomplete() with your argparse object
argcomplete.autocomplete(parser)

# Parse the arguments
args = parser.parse_args()

argcomplete only requires the parser object in order to conduct its auto completion, therefore it is really easy to implement!