Skip to content

Commit

Permalink
exit if no browser found, and change import style
Browse files Browse the repository at this point in the history
  • Loading branch information
snigdhasjg committed Oct 5, 2023
1 parent dda81b4 commit 58049af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions aws_console/input_output/browser.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import webbrowser
import pyperclip
import sys

def open_console(url: str, argument):
if argument.clip:
pyperclip.copy(url)
elif argument.stdout:
print(url)
else:
webbrowser.open(url)
elif not webbrowser.open_new_tab(url):
sys.exit("No browser found. Try --help for other options")
8 changes: 4 additions & 4 deletions aws_console/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from aws_console.input_output.cli import parse_arguments
from aws_console.input_output.browser import open_console
from .input_output.cli import parse_arguments
from .input_output.browser import open_console

from aws_console.credentials import aws_credentials
from aws_console.aws_console_login import signin_url
from .credentials import aws_credentials
from .aws_console_login import signin_url

def main():
args = parse_arguments()
Expand Down

0 comments on commit 58049af

Please sign in to comment.