Last active
March 29, 2025 16:08
-
-
Save thomd/e875f3289b72d4c142ab6b1d3e777f91 to your computer and use it in GitHub Desktop.
Graph::Easy bash completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
_graph_easy_completions() { | |
local cur prev opts filenames | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
opts="--help --input --output --as --from --renderer --parse --stats --timeout --verbose --boxart --html --svg --graphviz --dot --txt --vcg --gdl --graphml" | |
if [[ ${cur} == -* ]]; then | |
COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) | |
return 0 | |
fi | |
filenames=$(compgen -f "$cur") | |
COMPREPLY=( $(compgen -W "${filenames}" -- "${cur}") ) | |
case "${prev}" in | |
--input|--output) | |
COMPREPLY=($(compgen -f -- "${cur}")) | |
return 0 | |
;; | |
--as) | |
COMPREPLY=($(compgen -W "ascii boxart html svg graphviz dot txt vcg gdl graphml" -- "${cur}")) | |
return 0 | |
;; | |
--from) | |
COMPREPLY=($(compgen -W "graphviz txt vcg gdl" -- "${cur}")) | |
return 0 | |
;; | |
--renderer) | |
COMPREPLY=($(compgen -W "dot neato twopi fdp circo" -- "${cur}")) | |
return 0 | |
;; | |
esac | |
return 0 | |
} | |
complete -F _graph_easy_completions graph-easy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This file was created using the llm CLI tool from Simon Willison.