Skip to content

Commit 3276d4b

Browse files
committed
✨ feat: add debug options for commit command
✨ feat: add debug options for commit command ✨ Features: - Introduced debug options for the CLI that includes the commit command - Automatically inserts 'commit' command if no command is provided after debug flag ♻️ Refactoring: - Removed debug option from global options for clarity Enhanced CLI with debug options for better command handling
1 parent 2080150 commit 3276d4b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

commitloom/__main__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ def main() -> None:
133133
"""Entry point for the CLI."""
134134
known_commands = ['commit', 'stats', 'help']
135135
# These are options for the main CLI group
136-
global_options = ['-d', '--debug', '-v', '--version', '--help']
136+
global_options = ['-v', '--version', '--help']
137+
# These are debug options that should include commit command
138+
debug_options = ['-d', '--debug']
137139
# These are options specific to the commit command
138140
commit_options = ['-y', '--yes', '-c', '--combine', '-m', '--model']
139141

@@ -157,6 +159,15 @@ def main() -> None:
157159
cli(obj={})
158160
return
159161

162+
# If it's a debug option, add 'commit' after it to enable debugging for the commit command
163+
if first_arg in debug_options:
164+
# Check if there's a command after the debug flag
165+
if len(sys.argv) <= 2 or (len(sys.argv) > 2 and sys.argv[2].startswith('-')):
166+
# No command after debug flag, insert commit
167+
sys.argv.insert(2, 'commit')
168+
cli(obj={})
169+
return
170+
160171
# If it's a global option, don't insert commit
161172
if any(first_arg == opt for opt in global_options):
162173
cli(obj={})

0 commit comments

Comments
 (0)