Skip to content

Commit ba222c9

Browse files
committed
feat(cli): devbase scale をトップレベルショートカットとして追加
devbase container scale だけでなく devbase scale でも同等動作するようにした。 - lib/devbase/cli.py: SHORTCUTS / トップレベルパーサ / プレフィックス展開対象 / ヘルプに scale を追加 - bin/devbase: bash ラッパーの許可コマンド一覧に scale を追加
1 parent 58cfd99 commit ba222c9

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

bin/devbase

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ run_python() {
163163
# Resolve abbreviated command to full command name via unique prefix matching
164164
resolve_command() {
165165
local input="$1"
166-
local commands="init status container ct env plugin pl snapshot ss up down login build ps help"
166+
local commands="init status container ct env plugin pl snapshot ss up down login build ps scale help"
167167
local matches=()
168168
for cmd in $commands; do
169169
[[ "$cmd" == "$input"* ]] && matches+=("$cmd")
@@ -186,7 +186,7 @@ case "$_resolved_cmd" in
186186
# Python-implemented commands
187187
--version|-V)
188188
run_python "$@" ;;
189-
init|status|container|ct|env|plugin|pl|snapshot|ss|up|down|login|ps)
189+
init|status|container|ct|env|plugin|pl|snapshot|ss|up|down|login|ps|scale)
190190
run_python "${_resolved_cmd}" "${@:2}" ;;
191191
# Shell-implemented commands
192192
build) shift; cmd_build "$@" ;;

lib/devbase/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'login': ('container', 'login'),
2424
'build': ('container', 'build'),
2525
'ps': ('container', 'ps'),
26+
'scale': ('container', 'scale'),
2627
}
2728

2829
# Group aliases
@@ -196,6 +197,9 @@ def _add_shortcuts(subparsers):
196197
subparsers.add_parser('up', help='Start containers')
197198
subparsers.add_parser('down', help='Stop and remove containers')
198199

200+
scale_sc = subparsers.add_parser('scale', help='Scale containers online')
201+
scale_sc.add_argument('new_scale', type=int, help='New number of containers')
202+
199203

200204
def _create_parser():
201205
"""Create command line parser"""
@@ -210,6 +214,7 @@ def _create_parser():
210214
" login container login\n"
211215
" build container build\n"
212216
" ps container ps\n"
217+
" scale container scale\n"
213218
)
214219
)
215220

@@ -254,7 +259,7 @@ def _resolve_prefix(input_cmd, candidates):
254259
def _expand_argv():
255260
"""Expand abbreviated command/subcommand names in sys.argv in-place."""
256261
commands = ['init', 'status', 'container', 'ct', 'env', 'plugin', 'pl',
257-
'snapshot', 'ss', 'up', 'down', 'login', 'build', 'ps', 'help']
262+
'snapshot', 'ss', 'up', 'down', 'login', 'build', 'ps', 'scale', 'help']
258263
repo_subcmds = ['add', 'remove', 'list', 'refresh']
259264

260265
if len(sys.argv) >= 2 and not sys.argv[1].startswith('-'):

0 commit comments

Comments
 (0)