Skip to content

Commit 332f8c3

Browse files
committed
better logs on cli
1 parent bce0e8b commit 332f8c3

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/gitfetch/cli.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,18 @@ def _initialize_gitfetch(config_manager: ConfigManager) -> bool:
583583
print(f"Unsupported provider: {provider}", file=sys.stderr)
584584
return False
585585

586-
# Ask for token
586+
# Ask for token (optional - only for extra rate limits)
587587
token = ''
588588
env_var = PROVIDER_ENV_VARS.get(provider, '')
589+
590+
# Make it clear CLI is required, token is optional for rate limits
591+
if provider in ['github', 'gitlab']:
592+
cli_name = 'gh' if provider == 'github' else 'glab'
593+
print(f"\nNote: {cli_name} CLI is required for authentication.")
594+
print(f"Token is optional but increases rate limits.\n")
595+
589596
token_msg = f"Enter your {provider} personal access token"
590-
if provider == 'github':
591-
token_msg += " (needed for private repositories)"
592-
token_msg += f"\n(optional, press Enter to skip"
597+
token_msg += f"\n(optional - for higher rate limits, press Enter to skip"
593598
if env_var:
594599
token_msg += f", or set {env_var} env var"
595600
token_msg += "): "
@@ -612,14 +617,16 @@ def _initialize_gitfetch(config_manager: ConfigManager) -> bool:
612617
# Try to get authenticated user
613618
try:
614619
username = fetcher.get_authenticated_user()
615-
print(f"Using authenticated user: {username}")
620+
# Show auth status with token info
621+
token_status = "with token" if token else "without token (limited rate)"
622+
print(f"✓ Authenticated as: {username} ({token_status})")
616623
provider_config.username = username
617624
except Exception as e:
618625
print(f"Could not get authenticated user: {e}")
619626
if provider == 'github':
620-
print("Please authenticate with: gh auth login")
627+
print("Please install gh CLI and run: gh auth login")
621628
elif provider == 'gitlab':
622-
print("Please authenticate with: glab auth login")
629+
print("Please install glab CLI and run: glab auth login")
623630
else:
624631
print("Please ensure you have a valid token configured")
625632
return False

0 commit comments

Comments
 (0)