pepkit / looper

A job submitter for Portable Encapsulated Projects
http://looper.databio.org
BSD 2-Clause "Simplified" License
20 stars 7 forks source link

Add tab completion to Looper #422

Closed donaldcampbelljr closed 9 months ago

donaldcampbelljr commented 11 months ago

looper couldn't tab-complete

donaldcampbelljr commented 11 months ago

Potential solutions: use argcomplete https://kislyuk.github.io/argcomplete/ https://stackoverflow.com/questions/14597466/custom-tab-completion-in-python-argparse/15245680

nsheff commented 11 months ago

Here's how I did it in the past:

these are bash functions. they rely on an autocomplete CLI parameter. It's implemented here:

https://github.com/databio/markmeld/blob/a5736131dd8f531f0f34505c698dcc36e2cafb03/markmeld/cli.py#L145-L150

donaldcampbelljr commented 11 months ago

Looking at the markmeld example, it appears this can be used in two ways:

mm -c "demo/_markmeld.yaml" --autocomplete

or change to directory that contains a _markmeld.yaml and run:

mm --autocomplete

If items exist under targets, they are displayed in the CLI. Below example would display default as the target:

targets:
  default:
    jinja_template: md_template.jinja
    recursive_render: false

However, I'm not able to use tab complete when specifying targets.