Skip to content

Commit 35c9dbd

Browse files
refactor: Make box rebuild and sync commands use consistent flag-based arguments
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
1 parent 8bc8193 commit 35c9dbd

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎bead_cli/box.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,14 @@ class CmdRebuild(Command):
134134
def declare(self, arg):
135135
def setup_mutually_exclusive_args(parser):
136136
group = parser.argparser.add_mutually_exclusive_group()
137-
group.add_argument('box_name', nargs='?', help='Box name to rebuild')
137+
group.add_argument('--box', help='Box name to rebuild')
138138
group.add_argument('--dir', type=tech.fs.Path, help='Box directory to rebuild')
139139
group.add_argument('--all', action='store_true', help='Rebuild all boxes')
140140

141141
arg(setup_mutually_exclusive_args)
142142

143143
def run(self, args, env: 'Environment'):
144-
if not any([args.box_name, args.dir, args.all]):
144+
if not any([args.box, args.dir, args.all]):
145145
# No arguments provided - check if we can auto-detect single box
146146
boxes = env.get_boxes()
147147
if len(boxes) == 1:
@@ -152,7 +152,7 @@ def run(self, args, env: 'Environment'):
152152
print('ERROR: No boxes defined. Use "bead box add" to define a box first.')
153153
return
154154
else:
155-
print('ERROR: Multiple boxes defined. Must specify either a box name, --dir, or --all')
155+
print('ERROR: Multiple boxes defined. Must specify either --box, --dir, or --all')
156156
return
157157

158158
if args.all:
@@ -166,7 +166,7 @@ def run(self, args, env: 'Environment'):
166166
rebuild_directory(directory)
167167
else:
168168
# Rebuild specific box by name
169-
box_name = args.box_name
169+
box_name = args.box
170170
if not env.is_known_box(box_name):
171171
print(f'ERROR: Unknown box "{box_name}"')
172172
return
@@ -235,14 +235,14 @@ class CmdSync(Command):
235235
def declare(self, arg):
236236
def setup_mutually_exclusive_args(parser):
237237
group = parser.argparser.add_mutually_exclusive_group()
238-
group.add_argument('box_name', nargs='?', help='Box name to sync')
238+
group.add_argument('--box', help='Box name to sync')
239239
group.add_argument('--dir', type=tech.fs.Path, help='Box directory to sync')
240240
group.add_argument('--all', action='store_true', help='Sync all boxes')
241241

242242
arg(setup_mutually_exclusive_args)
243243

244244
def run(self, args, env: 'Environment'):
245-
if not any([args.box_name, args.dir, args.all]):
245+
if not any([args.box, args.dir, args.all]):
246246
# No arguments provided - check if we can auto-detect single box
247247
boxes = env.get_boxes()
248248
if len(boxes) == 1:
@@ -253,7 +253,7 @@ def run(self, args, env: 'Environment'):
253253
print('ERROR: No boxes defined. Use "bead box add" to define a box first.')
254254
return
255255
else:
256-
print('ERROR: Multiple boxes defined. Must specify either a box name, --dir, or --all')
256+
print('ERROR: Multiple boxes defined. Must specify either --box, --dir, or --all')
257257
return
258258

259259
if args.all:
@@ -267,7 +267,7 @@ def run(self, args, env: 'Environment'):
267267
sync_directory(directory)
268268
else:
269269
# Sync specific box by name
270-
box_name = args.box_name
270+
box_name = args.box
271271
if not env.is_known_box(box_name):
272272
print(f'ERROR: Unknown box "{box_name}"')
273273
return

0 commit comments

Comments
 (0)