Return touched filenames instead of printing them.

This commit is contained in:
Ethan Dalool 2020-07-16 21:31:16 -07:00
parent 453b2d2fb1
commit 5412af7d90

View file

@ -11,12 +11,12 @@ from voussoirkit import winglob
def touch(glob_pattern): def touch(glob_pattern):
filenames = winglob.glob(glob_pattern) filenames = winglob.glob(glob_pattern)
if len(filenames) == 0: if len(filenames) == 0:
safeprint.safeprint(glob_pattern)
open(glob_pattern, 'a').close() open(glob_pattern, 'a').close()
return [glob_pattern]
else: else:
for filename in filenames: for filename in filenames:
safeprint.safeprint(filename)
os.utime(filename) os.utime(filename)
return filenames
if __name__ == '__main__': if __name__ == '__main__':
glob_patterns = [clipext.resolve(x).strip() for x in sys.argv[1:]] glob_patterns = [clipext.resolve(x).strip() for x in sys.argv[1:]]