From ba222c95fa558cb693a83ff9e90ae9373b5e9d32 Mon Sep 17 00:00:00 2001 From: "takemi.ohama" Date: Wed, 13 May 2026 10:59:28 +0900 Subject: [PATCH] =?UTF-8?q?feat(cli):=20devbase=20scale=20=E3=82=92?= =?UTF-8?q?=E3=83=88=E3=83=83=E3=83=97=E3=83=AC=E3=83=99=E3=83=AB=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=BC=E3=83=88=E3=82=AB=E3=83=83=E3=83=88=E3=81=A8?= =?UTF-8?q?=E3=81=97=E3=81=A6=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit devbase container scale だけでなく devbase scale でも同等動作するようにした。 - lib/devbase/cli.py: SHORTCUTS / トップレベルパーサ / プレフィックス展開対象 / ヘルプに scale を追加 - bin/devbase: bash ラッパーの許可コマンド一覧に scale を追加 --- bin/devbase | 4 ++-- lib/devbase/cli.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) 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('-'):