Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/devbase
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 "$@" ;;
Expand Down
7 changes: 6 additions & 1 deletion lib/devbase/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
'login': ('container', 'login'),
'build': ('container', 'build'),
'ps': ('container', 'ps'),
'scale': ('container', 'scale'),
}

# Group aliases
Expand Down Expand Up @@ -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"""
Expand All @@ -210,6 +214,7 @@ def _create_parser():
" login container login\n"
" build container build\n"
" ps container ps\n"
" scale container scale\n"
)
)

Expand Down Expand Up @@ -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('-'):
Expand Down
Loading