feat: use sys.argv[1:] for help check and add tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
aseembits93 2026-04-06 16:09:47 -07:00
parent e3488bce6f
commit 48e6835990
2 changed files with 19 additions and 1 deletions

View file

@ -33,7 +33,7 @@ def main() -> None:
from codeflash.telemetry import posthog_cf
from codeflash.telemetry.sentry import init_sentry
if "--help" in sys.argv or "-h" in sys.argv:
if "--help" in sys.argv[1:] or "-h" in sys.argv[1:]:
print_codeflash_banner()
args = parse_args()
if args.command != "auth":

18
tests/test_help_banner.py Normal file
View file

@ -0,0 +1,18 @@
import subprocess
import sys
def test_help_displays_logo():
result = subprocess.run(
[sys.executable, "-c", "from codeflash.main import main; main()", "--help"], capture_output=True, text=True
)
assert result.returncode == 0
assert "codeflash.ai" in result.stdout
def test_help_short_flag_displays_logo():
result = subprocess.run(
[sys.executable, "-c", "from codeflash.main import main; main()", "-h"], capture_output=True, text=True
)
assert result.returncode == 0
assert "codeflash.ai" in result.stdout