From 3e1a24a2a6f0faa4604bc6a9cdd49335f6e640ff Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 6 Dec 2020 03:16:33 -0800 Subject: [PATCH] Move touch.py out of voussoirkit, into voussoir/cmd. Within voussoirkit, the solution for touching a single file is pathclass.Path.touch. --- voussoirkit/touch.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 voussoirkit/touch.py diff --git a/voussoirkit/touch.py b/voussoirkit/touch.py deleted file mode 100644 index fac9dab..0000000 --- a/voussoirkit/touch.py +++ /dev/null @@ -1,34 +0,0 @@ -''' -Create the file, or update the last modified timestamp. -''' -import argparse -import os -import sys - -from voussoirkit import pipeable -from voussoirkit import winglob - -def touch_argparse(args): - patterns = [pattern for arg in args.patterns for pattern in pipeable.input(arg)] - for pattern in patterns: - filenames = winglob.glob(pattern) - - if len(filenames) == 0 and not winglob.is_glob(pattern): - open(pattern, 'a').close() - print(pattern) - - for filename in filenames: - os.utime(filename) - print(filename) - -def main(argv): - parser = argparse.ArgumentParser(description=__doc__) - - parser.add_argument('patterns', nargs='+') - parser.set_defaults(func=touch_argparse) - - args = parser.parse_args(argv) - return args.func(args) - -if __name__ == '__main__': - raise SystemExit(main(sys.argv[1:]))