Skip to content

Commit c28957d

Browse files
committed
Update console scripts output
1 parent 8f70fde commit c28957d

File tree

1 file changed

+40
-10
lines changed
  • seleniumbase/console_scripts

1 file changed

+40
-10
lines changed

seleniumbase/console_scripts/run.py

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ def show_usage():
5050

5151

5252
def show_basic_usage():
53+
import time
5354
from seleniumbase.console_scripts import logo_helper
5455
seleniumbase_logo = logo_helper.get_seleniumbase_logo()
5556
print(seleniumbase_logo)
56-
print("%s" % get_version()[0:1])
57-
print("")
57+
time.sleep(0.25) # Enough time to see the logo
58+
print()
59+
show_package_location()
60+
show_version_info()
61+
print()
5862
sc = ("")
5963
sc += (' * USAGE: "seleniumbase [COMMAND] [PARAMETERS]"\n')
6064
sc += (' * OR: "sbase [COMMAND] [PARAMETERS]"\n')
@@ -431,19 +435,39 @@ def show_grid_node_usage():
431435
print("")
432436

433437

434-
def get_version():
435-
import pkg_resources
438+
def get_version_info():
439+
# from pkg_resources import get_distribution
440+
# version = get_distribution("seleniumbase").version
441+
from seleniumbase import __version__
436442
version_info = None
437-
try:
438-
version_info = pkg_resources.require("seleniumbase")[0:1]
439-
except Exception:
440-
version_info = ["ERROR: Cannot detect version! Please reinstall!"]
443+
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
444+
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
445+
c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
446+
cr = colorama.Style.RESET_ALL
447+
sb_text = c1 + "selenium" + c2 + "base" + cr
448+
version_info = "%s %s%s%s" % (sb_text, c3, __version__, cr)
441449
return version_info
442450

443451

444452
def show_version_info():
445-
version = get_version()
446-
print('\n%s\n' % version)
453+
version_info = get_version_info()
454+
print('%s' % version_info)
455+
456+
457+
def get_package_location():
458+
# from pkg_resources import get_distribution
459+
# location = get_distribution("seleniumbase").location
460+
import os
461+
import seleniumbase
462+
location = os.path.dirname(os.path.realpath(seleniumbase.__file__))
463+
if location.endswith("seleniumbase"):
464+
location = location[0:-len("seleniumbase")]
465+
return location
466+
467+
468+
def show_package_location():
469+
location = get_package_location()
470+
print("%s" % location)
447471

448472

449473
def show_options():
@@ -666,7 +690,13 @@ def main():
666690
show_grid_node_usage()
667691
elif command == "version" or command == "--version":
668692
if len(command_args) == 0:
693+
from seleniumbase.console_scripts import logo_helper
694+
seleniumbase_logo = logo_helper.get_seleniumbase_logo()
695+
print(seleniumbase_logo)
696+
print()
697+
show_package_location()
669698
show_version_info()
699+
print()
670700
else:
671701
show_basic_usage()
672702
elif command == "options" or command == "--options":

0 commit comments

Comments
 (0)