Skip to content

Commit 6b1cf23

Browse files
committed
Add "sbase" as a shorter "seleniumbase" for console scripts
1 parent 1ba71c3 commit 6b1cf23

File tree

6 files changed

+66
-42
lines changed

6 files changed

+66
-42
lines changed

seleniumbase/console_scripts/ReadMe.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
SeleniumBase console scripts help you get things done more easily, such as installing web drivers, creating a test directory with necessary configuration files, converting old WebDriver unittest scripts into SeleniumBase code, translating tests into multiple languages, and using the Selenium Grid.
66

77
Type ``seleniumbase`` on the command line to use console scripts.
8+
You can also use the simplified name: ``sbase`` instead.
89

9-
(<i>For running tests, [use **pytest** with SeleniumBase](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md).</i>)
10+
(<i>For running tests, [use <b>pytest</b> with SeleniumBase](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md).</i>)
1011

1112
### install
1213

seleniumbase/console_scripts/objectify.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,9 @@ def main(shell_command):
13781378
invalid_run_command(shell_command)
13791379

13801380
if sys.argv[0].split('/')[-1] == "seleniumbase" or (
1381-
sys.argv[0].split('\\')[-1] == "seleniumbase"):
1381+
sys.argv[0].split('\\')[-1] == "seleniumbase") or (
1382+
sys.argv[0].split('/')[-1] == "sbase") or (
1383+
sys.argv[0].split('\\')[-1] == "sbase"):
13821384
if num_args < 3:
13831385
invalid_run_command(shell_command)
13841386
elif num_args > 3:

seleniumbase/console_scripts/run.py

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@
33
44
Usage:
55
seleniumbase [COMMAND] [PARAMETERS]
6+
OR sbase [COMMAND] [PARAMETERS]
67
78
Examples:
8-
seleniumbase install chromedriver
9-
seleniumbase mkdir browser_tests
10-
seleniumbase convert my_old_webdriver_unittest.py
11-
seleniumbase translate my_first_test.py --zh -p
12-
seleniumbase extract-objects my_first_test.py
13-
seleniumbase inject-objects my_first_test.py
14-
seleniumbase objectify my_first_test.py
15-
seleniumbase revert-objects my_first_test.py
16-
seleniumbase encrypt OR seleniumbase obfuscate
17-
seleniumbase decrypt OR seleniumbase unobfuscate
18-
seleniumbase download server
19-
seleniumbase grid-hub start
20-
seleniumbase grid-node start --hub=127.0.0.1
9+
sbase install chromedriver
10+
sbase mkdir browser_tests
11+
sbase convert my_old_webdriver_unittest.py
12+
sbase translate my_first_test.py --zh -p
13+
sbase extract-objects my_first_test.py
14+
sbase inject-objects my_first_test.py
15+
sbase objectify my_first_test.py
16+
sbase revert-objects my_first_test.py
17+
sbase encrypt
18+
sbase decrypt
19+
sbase download server
20+
sbase grid-hub start
21+
sbase grid-node start --hub=127.0.0.1
2122
"""
2223

2324
import colorama
@@ -37,15 +38,16 @@
3738
def show_usage():
3839
show_basic_usage()
3940
sc = ("")
40-
sc += ('Type "seleniumbase --help" for details on all commands.\n')
41-
sc += ('Type "seleniumbase help [COMMAND]" for specific command info.\n')
41+
sc += ('Type "sbase help [COMMAND]" for specific command info.\n')
42+
sc += ('For info on all commands, type: "seleniumbase --help".\n')
4243
sc += ('* (Use "pytest" for running tests) *\n')
4344
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
4445
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
4546
c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
4647
c4 = colorama.Fore.MAGENTA + colorama.Back.LIGHTYELLOW_EX
4748
cr = colorama.Style.RESET_ALL
4849
sc = sc.replace("seleniumbase", c1 + "selenium" + c2 + "base" + cr)
50+
sc = sc.replace("sbase", c1 + "s" + c2 + "base" + cr)
4951
sc = sc.replace("pytest", c3 + "pytest" + cr)
5052
sc = sc.replace("--help", c4 + "--help" + cr)
5153
sc = sc.replace("help", c4 + "help" + cr)
@@ -57,28 +59,31 @@ def show_basic_usage():
5759
print(seleniumbase_logo)
5860
print("%s" % get_version()[0:1])
5961
print("")
60-
sc = ("\n")
62+
sc = ("")
6163
sc += ('Usage: "seleniumbase [COMMAND] [PARAMETERS]"\n')
64+
sc += ('(short name): "sbase [COMMAND] [PARAMETERS]"\n')
65+
sc += ("\n")
6266
sc += ("Commands:\n")
63-
sc += (" install [DRIVER_NAME] [OPTIONS]\n")
64-
sc += (" mkdir [NEW_TEST_DIRECTORY_NAME]\n")
65-
sc += (" convert [PYTHON_WEBDRIVER_UNITTEST_FILE]\n")
66-
sc += (" translate [SB_PYTHON_FILE] [LANGUAGE] [ACTION]\n")
67-
sc += (" extract-objects [SB_PYTHON_FILE]\n")
68-
sc += (" inject-objects [SB_PYTHON_FILE] [OPTIONS]\n")
69-
sc += (" objectify [SB_PYTHON_FILE] [OPTIONS]\n")
70-
sc += (" revert-objects [SB_PYTHON_FILE]\n")
71-
sc += (" encrypt (OR: obfuscate)\n")
72-
sc += (" decrypt (OR: unobfuscate)\n")
73-
sc += (" download server (The Selenium Server JAR file)\n")
74-
sc += (" grid-hub [start|stop] [OPTIONS]\n")
75-
sc += (" grid-node [start|stop] --hub=[HUB_IP] [OPTIONS]\n")
76-
sc += (' * (EXAMPLE: "seleniumbase install chromedriver latest") *\n')
67+
sc += (" install [DRIVER_NAME] [OPTIONS]\n")
68+
sc += (" mkdir [NEW_TEST_DIRECTORY_NAME]\n")
69+
sc += (" convert [PYTHON_WEBDRIVER_UNITTEST_FILE]\n")
70+
sc += (" translate [SB_PYTHON_FILE] [LANGUAGE] [ACTION]\n")
71+
sc += (" extract-objects [SB_PYTHON_FILE]\n")
72+
sc += (" inject-objects [SB_PYTHON_FILE] [OPTIONS]\n")
73+
sc += (" objectify [SB_PYTHON_FILE] [OPTIONS]\n")
74+
sc += (" revert-objects [SB_PYTHON_FILE]\n")
75+
sc += (" encrypt (OR: obfuscate)\n")
76+
sc += (" decrypt (OR: unobfuscate)\n")
77+
sc += (" download server (Selenium Server JAR file)\n")
78+
sc += (" grid-hub [start|stop] [OPTIONS]\n")
79+
sc += (" grid-node [start|stop] --hub=[HUB_IP] [OPTIONS]\n")
80+
sc += (' * (EXAMPLE: "sbase install chromedriver latest") *\n')
7781
sc += ("")
7882
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
7983
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
8084
cr = colorama.Style.RESET_ALL
8185
sc = sc.replace("seleniumbase", c1 + "selenium" + c2 + "base" + cr)
86+
sc = sc.replace("sbase", c1 + "s" + c2 + "base" + cr)
8287
print(sc)
8388

8489

@@ -87,6 +92,7 @@ def show_install_usage():
8792
print("")
8893
print(" Usage:")
8994
print(" seleniumbase install [DRIVER_NAME] [OPTIONS]")
95+
print(" OR: sbase install [DRIVER_NAME] [OPTIONS]")
9096
print(" (Drivers: chromedriver, geckodriver, edgedriver")
9197
print(" iedriver, operadriver)")
9298
print(" Options:")
@@ -116,6 +122,7 @@ def show_mkdir_usage():
116122
print("")
117123
print(" Usage:")
118124
print(" seleniumbase mkdir [DIRECTORY_NAME]")
125+
print(" OR: sbase mkdir [DIRECTORY_NAME]")
119126
print(" Example:")
120127
print(" seleniumbase mkdir browser_tests")
121128
print(" Output:")
@@ -132,6 +139,7 @@ def show_convert_usage():
132139
print("")
133140
print(" Usage:")
134141
print(" seleniumbase convert [PYTHON_WEBDRIVER_UNITTEST_FILE]")
142+
print(" OR: sbase convert [PYTHON_WEBDRIVER_UNITTEST_FILE]")
135143
print(" Output:")
136144
print(" Converts a Selenium IDE exported WebDriver unittest")
137145
print(" file into a SeleniumBase file. Adds _SB to the new")
@@ -145,6 +153,7 @@ def show_translate_usage():
145153
print(" ** translate **")
146154
print(" Usage:")
147155
print(" seleniumbase translate [SB_FILE].py [LANGUAGE] [ACTION]")
156+
print(" OR: sbase translate [SB_FILE].py [LANGUAGE] [ACTION]")
148157
print(" Languages:")
149158
print(" --en / --English | --zh / --Chinese")
150159
print(" --nl / --Dutch | --fr / --French")
@@ -173,6 +182,7 @@ def show_extract_objects_usage():
173182
print("")
174183
print(" Usage:")
175184
print(" seleniumbase extract-objects [SELENIUMBASE_PYTHON_FILE]")
185+
print(" OR: sbase extract-objects [SELENIUMBASE_PYTHON_FILE]")
176186
print(" Output:")
177187
print(" Creates page objects based on selectors found in a")
178188
print(" seleniumbase Python file and saves those objects to the")
@@ -185,6 +195,7 @@ def show_inject_objects_usage():
185195
print("")
186196
print(" Usage:")
187197
print(" seleniumbase inject-objects [SELENIUMBASE_PYTHON_FILE]")
198+
print(" OR: sbase inject-objects [SELENIUMBASE_PYTHON_FILE]")
188199
print(" Options:")
189200
print(" -c, --comments (Add object selectors to the comments.)")
190201
print(" (Default: No added comments.)")
@@ -200,6 +211,7 @@ def show_objectify_usage():
200211
print("")
201212
print(" Usage:")
202213
print(" seleniumbase objectify [SELENIUMBASE_PYTHON_FILE]")
214+
print(" OR: sbase objectify [SELENIUMBASE_PYTHON_FILE]")
203215
print(" Options:")
204216
print(" -c, --comments (Add object selectors to the comments.)")
205217
print(" (Default: No added comments.)")
@@ -218,6 +230,7 @@ def show_revert_objects_usage():
218230
print("")
219231
print(" Usage:")
220232
print(" seleniumbase revert-objects [SELENIUMBASE_PYTHON_FILE]")
233+
print(" OR: sbase revert-objects [SELENIUMBASE_PYTHON_FILE]")
221234
print(" Options:")
222235
print(" -c, --comments (Keep existing comments for the lines.)")
223236
print(" (Default: No comments are kept.)")
@@ -233,11 +246,11 @@ def show_encrypt_usage():
233246
print(" ** encrypt OR obfuscate **")
234247
print("")
235248
print(" Usage:")
236-
print(" seleniumbase encrypt")
237-
print(" OR")
238-
print(" seleniumbase obfuscate")
249+
print(" seleniumbase encrypt || seleniumbase obfuscate")
250+
print(" --OR--")
251+
print(" sbase encrypt || sbase obfuscate")
239252
print(" Output:")
240-
print(" Runs the password obfuscation tool.")
253+
print(" Runs the password encryption/obfuscation tool.")
241254
print(" (Where you can enter a password to encrypt/obfuscate.)")
242255
print("")
243256

@@ -246,9 +259,9 @@ def show_decrypt_usage():
246259
print(" ** decrypt OR unobfuscate **")
247260
print("")
248261
print(" Usage:")
249-
print(" seleniumbase decrypt")
250-
print(" OR")
251-
print(" seleniumbase unobfuscate")
262+
print(" seleniumbase decrypt || seleniumbase unobfuscate")
263+
print(" --OR--")
264+
print(" sbase decrypt || sbase unobfuscate")
252265
print(" Output:")
253266
print(" Runs the password decryption/unobfuscation tool.")
254267
print(" (Where you can enter an encrypted password to decrypt.)")
@@ -260,6 +273,7 @@ def show_download_usage():
260273
print("")
261274
print(" Usage:")
262275
print(" seleniumbase download server")
276+
print(" OR: sbase download server")
263277
print(" Output:")
264278
print(" Downloads the Selenium Standalone Server.")
265279
print(" (Server is required for using your own Selenium Grid.)")
@@ -271,6 +285,7 @@ def show_grid_hub_usage():
271285
print("")
272286
print(" Usage:")
273287
print(" seleniumbase grid-hub {start|stop}")
288+
print(" OR: sbase grid-hub {start|stop}")
274289
print(" Options:")
275290
print(" -v, --verbose (Increase verbosity of logging output.)")
276291
print(" (Default: Quiet logging / not verbose.)")
@@ -290,6 +305,7 @@ def show_grid_node_usage():
290305
print("")
291306
print(" Usage:")
292307
print(" seleniumbase grid-node {start|stop} [OPTIONS]")
308+
print(" OR: sbase grid-node {start|stop} [OPTIONS]")
293309
print(" Options:")
294310
print(" --hub=[HUB_IP] (The Grid Hub IP Address to connect to.)")
295311
print(" (Default: 127.0.0.1 if not set)")

seleniumbase/console_scripts/sb_install.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def main(override=None):
9191

9292
num_args = len(sys.argv)
9393
if sys.argv[0].split('/')[-1].lower() == "seleniumbase" or (
94-
sys.argv[0].split('\\')[-1].lower() == "seleniumbase"):
94+
sys.argv[0].split('\\')[-1].lower() == "seleniumbase") or (
95+
sys.argv[0].split('/')[-1].lower() == "sbase") or (
96+
sys.argv[0].split('\\')[-1].lower() == "sbase"):
9597
if num_args < 3 or num_args > 5:
9698
invalid_run_command()
9799
else:

seleniumbase/console_scripts/sb_mkdir.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ def invalid_run_command():
3434

3535
def main():
3636
num_args = len(sys.argv)
37-
if sys.argv[0].split('/')[-1] == "seleniumbase" or (
38-
sys.argv[0].split('\\')[-1] == "seleniumbase"):
37+
if sys.argv[0].split('/')[-1].lower() == "seleniumbase" or (
38+
sys.argv[0].split('\\')[-1].lower() == "seleniumbase") or (
39+
sys.argv[0].split('/')[-1].lower() == "sbase") or (
40+
sys.argv[0].split('\\')[-1].lower() == "sbase"):
3941
if num_args < 3 or num_args > 3:
4042
invalid_run_command()
4143
else:

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
entry_points={
162162
'console_scripts': [
163163
'seleniumbase = seleniumbase.console_scripts.run:main',
164+
'sbase = seleniumbase.console_scripts.run:main', # Simplified name
164165
],
165166
'nose.plugins': [
166167
'base_plugin = seleniumbase.plugins.base_plugin:Base',

0 commit comments

Comments
 (0)