MCPcopy Create free account
hub / github.com/ActiveState/code / exec_cmd

Function exec_cmd

recipes/Python/576537_Deep_rename/recipe-576537.py:159–182  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157 raise Exception("Fatal: editor swap files ('.swp') detected: %s" % ', '.join(swappaths))
158
159def exec_cmd():
160 global INTERACTIVE, MAKE_BACKUPS, DRY_RUN
161 oplist,args = getopt.getopt(sys.argv[1:],"ibldh")
162 check_bakfiles()
163 check_swapfiles()
164 for opt, val in oplist:
165 if opt == '-h':
166 print USAGE
167 return None
168 if opt == '-i':
169 INTERACTIVE = True
170 elif opt == '-b':
171 MAKE_BACKUPS = True
172 elif opt == '-d':
173 DRY_RUN = True
174 elif opt == '-l':
175 for filename in gen_filepaths():
176 print filename
177 return None
178 if len(args) != 2:
179 print USAGE
180 return None
181 name, sub = args
182 deeprename_files(re.compile(r"\b" + name + r"\b"), sub)
183
184if __name__ == '__main__':
185 exec_cmd()

Callers 1

recipe-576537.pyFile · 0.85

Calls 6

check_bakfilesFunction · 0.85
check_swapfilesFunction · 0.85
gen_filepathsFunction · 0.85
deeprename_filesFunction · 0.85
getoptMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected