diff --git a/bash-completion b/bash-completion index cdd6fa8..d76f5ab 100644 --- a/bash-completion +++ b/bash-completion @@ -48,9 +48,9 @@ _cqfd() { local arg= _get_first_arg - if [[ "$arg" == run ]]; then + if [[ "$arg" =~ ^(exec|run)$ ]]; then for (( i=1; i <= cword; i++ )); do - if [[ ${words[i]} == run ]]; then + if [[ ${words[i]} =~ ^(exec|run)$ ]]; then if [[ $((i+1)) -eq $cword ]]; then break elif [[ ${words[i+1]} == -c ]]; then @@ -61,7 +61,11 @@ _cqfd() { fi done - COMPREPLY=( $(compgen -c -W "-c" -- "$cur") ) + if [[ "$arg" == exec ]]; then + COMPREPLY=( $(compgen -c -- "$cur") ) + else + COMPREPLY=( $(compgen -c -W "-c" -- "$cur") ) + fi return elif [[ "$arg" == shell ]]; then for (( i=1; i <= cword; i++ )); do @@ -84,7 +88,7 @@ _cqfd() { return fi - local cmds="init flavors run release shell version help" + local cmds="init flavors exec run release shell version help" COMPREPLY=( $(compgen -W "$cmds $opts" -- "$cur") ) } && complete -F _cqfd cqfd diff --git a/cqfd b/cqfd index 4abc2f2..d82fc47 100755 --- a/cqfd +++ b/cqfd @@ -44,6 +44,7 @@ Options: Commands: init Initialize project build container. flavors List flavors from config file to stdout. + exec cmd [args] Run argument(s) inside build container. run [cmdstring] Run argument(s) inside build container. release [cmdstring] Run argument(s) and release software. shell [shargs] Run shell command inside build container. @@ -493,6 +494,16 @@ while [ $# -gt 0 ]; do -q) quiet=true ;; + exec) + if [ "$#" -lt 2 ]; then + die "command exec requires arguments" + fi + shift + config_load $flavor + command_string="${@@Q}" + docker_run "$command_string" + exit + ;; run|release) if [ "$1" = "release" ]; then has_to_release=true