diff --git a/bin/devbase b/bin/devbase index 2243d7f..4d73dfc 100755 --- a/bin/devbase +++ b/bin/devbase @@ -163,7 +163,7 @@ run_python() { # Resolve abbreviated command to full command name via unique prefix matching resolve_command() { local input="$1" - local commands="init status container ct env plugin pl snapshot ss up down login build ps help" + local commands="init status container ct env plugin pl snapshot ss up down login build ps scale help" local matches=() for cmd in $commands; do [[ "$cmd" == "$input"* ]] && matches+=("$cmd") @@ -186,7 +186,7 @@ case "$_resolved_cmd" in # Python-implemented commands --version|-V) run_python "$@" ;; - init|status|container|ct|env|plugin|pl|snapshot|ss|up|down|login|ps) + init|status|container|ct|env|plugin|pl|snapshot|ss|up|down|login|ps|scale) run_python "${_resolved_cmd}" "${@:2}" ;; # Shell-implemented commands build) shift; cmd_build "$@" ;; diff --git a/lib/devbase/cli.py b/lib/devbase/cli.py index 412c917..b863751 100644 --- a/lib/devbase/cli.py +++ b/lib/devbase/cli.py @@ -23,6 +23,7 @@ 'login': ('container', 'login'), 'build': ('container', 'build'), 'ps': ('container', 'ps'), + 'scale': ('container', 'scale'), } # Group aliases @@ -196,6 +197,9 @@ def _add_shortcuts(subparsers): subparsers.add_parser('up', help='Start containers') subparsers.add_parser('down', help='Stop and remove containers') + scale_sc = subparsers.add_parser('scale', help='Scale containers online') + scale_sc.add_argument('new_scale', type=int, help='New number of containers') + def _create_parser(): """Create command line parser""" @@ -210,6 +214,7 @@ def _create_parser(): " login container login\n" " build container build\n" " ps container ps\n" + " scale container scale\n" ) ) @@ -254,7 +259,7 @@ def _resolve_prefix(input_cmd, candidates): def _expand_argv(): """Expand abbreviated command/subcommand names in sys.argv in-place.""" commands = ['init', 'status', 'container', 'ct', 'env', 'plugin', 'pl', - 'snapshot', 'ss', 'up', 'down', 'login', 'build', 'ps', 'help'] + 'snapshot', 'ss', 'up', 'down', 'login', 'build', 'ps', 'scale', 'help'] repo_subcmds = ['add', 'remove', 'list', 'refresh'] if len(sys.argv) >= 2 and not sys.argv[1].startswith('-'):