MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / main

Function main

seleniumbase/console_scripts/sb_mkdir.py:52–853  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50
51
52def main():
53 c1 = ""
54 c5 = ""
55 c7 = ""
56 cr = ""
57 if "linux" not in sys.platform:
58 c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
59 c5 = colorama.Fore.RED + colorama.Back.LIGHTYELLOW_EX
60 c7 = colorama.Fore.BLACK + colorama.Back.MAGENTA
61 cr = colorama.Style.RESET_ALL
62
63 gha = False
64 basic = False
65 help_me = False
66 error_msg = None
67 invalid_cmd = None
68
69 command_args = sys.argv[2:]
70 dir_name = command_args[0]
71 if dir_name == "-h" or dir_name == "--help":
72 invalid_run_command("help")
73 elif len(str(dir_name)) < 2:
74 error_msg = "Directory name length must be at least 2 characters long!"
75 elif "/" in str(dir_name) or "\\" in str(dir_name):
76 error_msg = 'Directory name must not include slashes ("/", "\\")!'
77 elif dir_name.startswith("-"):
78 error_msg = 'Directory name cannot start with "-"!'
79 elif os.path.exists(os.getcwd() + "/" + dir_name):
80 error_msg = (
81 'Directory "%s" already exists in this directory!' % dir_name
82 )
83 if error_msg:
84 error_msg = c5 + "ERROR: " + error_msg + cr
85 invalid_run_command(error_msg)
86
87 if len(command_args) >= 2:
88 options = command_args[1:]
89 for option in options:
90 option = option.lower()
91 if option == "-h" or option == "--help":
92 help_me = True
93 elif option == "-b" or option == "--basic":
94 basic = True
95 elif option == "--gha":
96 gha = True
97 else:
98 invalid_cmd = "\n===> INVALID OPTION: >> %s <<\n" % option
99 invalid_cmd = invalid_cmd.replace(">> ", ">>" + c5 + " ")
100 invalid_cmd = invalid_cmd.replace(" <<", " " + cr + "<<")
101 invalid_cmd = invalid_cmd.replace(">>", c7 + ">>" + cr)
102 invalid_cmd = invalid_cmd.replace("<<", c7 + "<<" + cr)
103 help_me = True
104 break
105 if help_me:
106 invalid_run_command(invalid_cmd)
107
108 os.mkdir(dir_name)
109

Callers

nothing calls this directly

Calls 2

closeMethod · 0.80
invalid_run_commandFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…