Skip to content

Commit 48e6835

Browse files
aseembits93claude
andcommitted
feat: use sys.argv[1:] for help check and add tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e3488bc commit 48e6835

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

codeflash/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def main() -> None:
3333
from codeflash.telemetry import posthog_cf
3434
from codeflash.telemetry.sentry import init_sentry
3535

36-
if "--help" in sys.argv or "-h" in sys.argv:
36+
if "--help" in sys.argv[1:] or "-h" in sys.argv[1:]:
3737
print_codeflash_banner()
3838
args = parse_args()
3939
if args.command != "auth":

tests/test_help_banner.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import subprocess
2+
import sys
3+
4+
5+
def test_help_displays_logo():
6+
result = subprocess.run(
7+
[sys.executable, "-c", "from codeflash.main import main; main()", "--help"], capture_output=True, text=True
8+
)
9+
assert result.returncode == 0
10+
assert "codeflash.ai" in result.stdout
11+
12+
13+
def test_help_short_flag_displays_logo():
14+
result = subprocess.run(
15+
[sys.executable, "-c", "from codeflash.main import main; main()", "-h"], capture_output=True, text=True
16+
)
17+
assert result.returncode == 0
18+
assert "codeflash.ai" in result.stdout

0 commit comments

Comments
 (0)