Example #1
0
 def paths_type(cls, globstr: str) -> typing.List[str]:
     """Retrieve list of paths matching the globstr passed."""
     paths = glob.glob(os.path.expanduser(escape_glob(globstr)),
                       recursive=True)
     if not paths:
         raise ArgumentError(f"No paths matching '{globstr}'")
     return paths
Example #2
0
 def run(self, text: str):
     """Run an external command text."""
     text = escape_glob(text.strip())
     pipe = text.endswith("|")
     split = shlex.split(text.rstrip("|"))
     command, args = split[0], split[1:]
     self(command, *args, pipe=pipe)
def test_glob_escape(char):
    assert utils.escape_glob(rf"test{char}.jpg") == f"test{char}.jpg"
    assert utils.escape_glob(rf"test\{char}.jpg") == f"test[{char}].jpg"