Skip to content

Commit

Permalink
Merge pull request #431 from pepkit/dev_tab_completion
Browse files Browse the repository at this point in the history
tab completion
  • Loading branch information
donaldcampbelljr committed Dec 18, 2023
2 parents c06bb1e + b0cc336 commit 37dacb0
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bash_complete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Begin looper bash autocomplete
_looper_autocomplete()
{
local cur prev opts1
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
opts1=$(looper --commands)
case ${COMP_CWORD} in
1)
COMPREPLY=($(compgen -W "${opts1}" -- ${cur}))
;;
2)
COMPREPLY=()
;;
esac
} && complete -o bashdefault -o default -F _looper_autocomplete looper
# end looper bash autocomplete
27 changes: 27 additions & 0 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,30 @@ Once a pipeline is submitted any remaining interface files will be ignored.
Until an appropriate pipeline is found, each interface file will be considered in succession.
If no suitable pipeline is found in any interface, the sample will be skipped.
In other words, the `pipeline_interfaces` value specifies a *prioritized* search list.

## Set up tab completion

Source `bash_complete.sh` to your `~/.bashrc` to get basic tab completion for Looper.

Then, simply type `looper <tab> <tab>` to see a list of commands and `looper comma<tab>` to get autocompletion for specific commands.

Source script to add to `~/.bashrc`:
```bash
# Begin looper bash autocomplete
_looper_autocomplete()
{
local cur prev opts1
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
opts1=$(looper --commands)
case ${COMP_CWORD} in
1)
COMPREPLY=($(compgen -W "${opts1}" -- ${cur}))
;;
2)
COMPREPLY=()
;;
esac
} && complete -o bashdefault -o default -F _looper_autocomplete looper
# end looper bash autocomplete
```
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Added
- `looper link` creates symlinks for results grouped by record_identifier. It requires pipestat to be configured. [#72](https://github.com/pepkit/looper/issues/72)
- basic tab completion

### Changed
- looper now works with pipestat v0.6.0 and greater.
- `looper table`, `check` now use pipestat and therefore require pipestat configuration. [#390](https://github.com/pepkit/looper/issues/390)
- changed how looper configures pipestat [#411](https://github.com/pepkit/looper/issues/411)
- initializing pipeline interface also writes an example `output_schema.yaml` and `count_lines.sh` pipeline

### Fixed
- filtering via attributes that are integers.

## [1.5.1] -- 2023-08-14

### Fixed
Expand Down
6 changes: 6 additions & 0 deletions looper/cli_looper.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,12 @@ def add_subparser(cmd):
help="Number of attributes to display",
type=int,
)
parser.add_argument(
"--commands",
action="version",
version="{}".format(" ".join(subparsers.choices.keys())),
)

result.append(parser)
return result

Expand Down

0 comments on commit 37dacb0

Please sign in to comment.