Skip to content

Commit 6e38f96

Browse files
committed
some click
1 parent 03a3507 commit 6e38f96

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

codeflash/cli_cmds/cmd_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def collect_setup_info() -> CLISetupInfo:
530530

531531
def check_for_toml_or_setup_file() -> str | None:
532532
console.print()
533-
console.print("Checking for pyproject.toml or setup.py…\r", nl=False)
533+
console.print("Checking for pyproject.toml or setup.py…\r")
534534
curdir = Path.cwd()
535535
pyproject_toml_path = curdir / "pyproject.toml"
536536
setup_py_path = curdir / "setup.py"

codeflash/code_utils/oauth_handler.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
import urllib.parse
1515
import webbrowser
1616

17-
import click
1817
import requests
1918

2019
from codeflash.api.cfapi import get_cfapi_base_urls
20+
from codeflash.cli_cmds.console import console
2121

2222

2323
class OAuthHandler:
@@ -737,19 +737,19 @@ def perform_oauth_signin() -> str | None:
737737
try:
738738
httpd = oauth.start_local_server(port)
739739
except Exception:
740-
click.echo("❌ Failed to start local server.")
740+
console.print("❌ Failed to start local server.")
741741
return None
742742

743743
if should_attempt_browser_launch():
744744
# Try to open browser
745-
click.echo("🌐 Opening browser to sign in to CodeFlash…")
745+
console.print("🌐 Opening browser to sign in to CodeFlash…")
746746
with contextlib.suppress(Exception):
747747
webbrowser.open(local_auth_url)
748748

749749
# Show remote URL and start input thread
750-
click.echo("\n📋 If browser didn't open, visit this URL:")
751-
click.echo(f"\n{remote_auth_url}\n")
752-
click.echo("Paste code here if prompted > ", nl=False)
750+
console.print("\n📋 If browser didn't open, visit this URL:")
751+
console.print(f"\n{remote_auth_url}\n")
752+
console.print("Paste code here if prompted > ", end="")
753753

754754
# Start thread to wait for manual input
755755
input_thread = threading.Thread(target=_wait_for_manual_code_input, args=(oauth,))
@@ -763,7 +763,7 @@ def perform_oauth_signin() -> str | None:
763763

764764
if not oauth.is_complete:
765765
httpd.shutdown()
766-
click.echo("\n❌ Authentication timed out.")
766+
console.print("\n❌ Authentication timed out.")
767767
return None
768768

769769
# Check which method completed
@@ -776,7 +776,7 @@ def perform_oauth_signin() -> str | None:
776776
# Browser callback received
777777
if oauth.error or not oauth.state or oauth.state != state:
778778
httpd.shutdown()
779-
click.echo("\n❌ Unauthorized.")
779+
console.print("\n❌ Unauthorized.")
780780
return None
781781

782782
api_key = oauth.exchange_code_for_token(oauth.code, code_verifier, local_redirect_uri)
@@ -786,6 +786,6 @@ def perform_oauth_signin() -> str | None:
786786
httpd.shutdown()
787787

788788
if not api_key:
789-
click.echo("\n❌ Authentication failed.")
790-
click.echo("\n")
789+
console.print("\n❌ Authentication failed.")
790+
console.print("\n")
791791
return api_key

0 commit comments

Comments
 (0)