• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Chungzter / CommiZard / 22175638425

19 Feb 2026 09:15AM UTC coverage: 99.132% (-0.2%) from 99.348%
22175638425

push

github

web-flow
Merge pull request #165 from Chungzter/fix-arg-parse

Fix arg parsing functions

16 of 18 new or added lines in 2 files covered. (88.89%)

457 of 461 relevant lines covered (99.13%)

0.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.55
/src/commizard/cli.py
1
from __future__ import annotations
1✔
2

3
import concurrent.futures
1✔
4
import sys
1✔
5

6
from . import __version__ as version
1✔
7
from . import config, output, start
1✔
8

9
help_msg = """
1✔
10
Commit writing wizard
11

12
Usage:
13
  commizard [-v | --version] [-h | --help] [--no-color] [--no-banner]
14
            [--no-stream]
15

16
Options:
17
  -h, --help       Show help for commizard
18
  -v, --version    Show version information
19
  --no-color       Don't colorize output
20
  --no-banner      Disable the ASCII welcome banner
21
  --no-stream      Disable streaming and return the full response at once
22
"""
23

24

25
def handle_args():
1✔
26
    if len(sys.argv) < 2:
1✔
27
        return
1✔
28
    supported_args = [
1✔
29
        "-v",
30
        "--version",
31
        "-h",
32
        "--help",
33
        "--no-banner",
34
        "--no-color",
35
        "--no-stream",
36
    ]
37
    for arg in sys.argv[1:]:
1✔
38
        if arg not in supported_args:
1✔
39
            print(f"Unknown option: {arg}", file=sys.stderr)
1✔
40
            print("try 'commizard -h' for more information.", file=sys.stderr)
1✔
41
            sys.exit(2)
1✔
42
        if arg in ("-v", "--version"):
1✔
43
            print(f"CommiZard {version}")
1✔
44
            sys.exit(0)
1✔
45
        elif arg in ("-h", "--help"):
1✔
46
            print(help_msg.strip(), end="\n")
1✔
47
            sys.exit(0)
1✔
48
        elif arg == "--no-banner":
1✔
49
            config.SHOW_BANNER = False
1✔
50
        elif arg == "--no-color":
1✔
51
            config.USE_COLOR = False
1✔
NEW
52
        elif arg == "--no-stream":
×
NEW
53
            config.STREAM = False
×
54

55

56
def main() -> int:
1✔
57
    """
58
    This is the entry point of the program. calls some functions at the start,
59
    then jumps into an infinite loop.
60

61
    Returns:
62
        int: Exit code (0 for success, non-zero for errors)
63
    """
64
    handle_args()
1✔
65

66
    with concurrent.futures.ThreadPoolExecutor() as executor:
1✔
67
        executor.submit(output.init_console, config.USE_COLOR)
1✔
68
        fut_ai = executor.submit(start.local_ai_available)
1✔
69
        fut_git = executor.submit(start.check_git_installed)
1✔
70

71
        git_ok = fut_git.result()
1✔
72

73
    if not git_ok:
1✔
74
        output.print_error("git not installed")
1✔
75
        return 1
1✔
76
    if not start.is_inside_working_tree():
1✔
77
        output.print_error("not inside work tree")
1✔
78
        return 1
1✔
79

80
    if config.SHOW_BANNER:
1✔
81
        start.print_welcome(config.USE_COLOR)
1✔
82

83
    local_ai_ok = fut_ai.result()
1✔
84
    if not local_ai_ok:
1✔
85
        output.print_warning("local AI not available")
1✔
86

87
    from . import commands
1✔
88

89
    try:
1✔
90
        while True:
1✔
91
            user_input = input("CommiZard> ").strip()
1✔
92
            if user_input in ("exit", "quit"):
1✔
93
                print("Goodbye!")
1✔
94
                break
1✔
95
            elif user_input == "":
1✔
96
                continue
1✔
97
            commands.parser(user_input)
1✔
98
    except (EOFError, KeyboardInterrupt):
1✔
99
        print("\nGoodbye!")
1✔
100

101
    return 0
1✔
102

103

104
if __name__ == "__main__":  # pragma: no cover
105
    main()
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc