()
| 157 | raise Exception("Fatal: editor swap files ('.swp') detected: %s" % ', '.join(swappaths)) |
| 158 | |
| 159 | def 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 | |
| 184 | if __name__ == '__main__': |
| 185 | exec_cmd() |
no test coverage detected