From 0f2dc36a6b82d741fc06a3ded0a941e41b6b8e43 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 25 May 2021 01:35:46 -0700 Subject: [PATCH] Migrate scripts from pipeable.output to pipeable.stdout. --- crlf.py | 2 +- delete.py | 4 ++-- eval.py | 2 +- groups_of.py | 2 +- lowercase.py | 2 +- move_all.py | 2 +- recycle.py | 2 +- replace.py | 2 +- sorted.py | 2 +- sum.py | 2 +- tempeditor.py | 2 +- touch.py | 4 ++-- unique.py | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crlf.py b/crlf.py index f1a4342..6e1113a 100644 --- a/crlf.py +++ b/crlf.py @@ -21,7 +21,7 @@ def crlf(filename): def main(args): for line in pipeable.go(args, strip=True, skip_blank=True): for filename in winglob.glob(line): - pipeable.output(filename) + pipeable.stdout(filename) crlf(filename) if __name__ == '__main__': diff --git a/delete.py b/delete.py index 9738f31..6c65edb 100644 --- a/delete.py +++ b/delete.py @@ -7,8 +7,8 @@ from voussoirkit import winglob for pattern in pipeable.go(skip_blank=True): for name in winglob.glob(pattern): if os.path.isfile(name): - pipeable.output(name) + pipeable.stdout(name) os.remove(name) elif os.path.isdir(name): - pipeable.output(name) + pipeable.stdout(name) shutil.rmtree(name) diff --git a/eval.py b/eval.py index f0d2dcf..00a6ee7 100644 --- a/eval.py +++ b/eval.py @@ -23,7 +23,7 @@ def random_hex(length=12): def eval_argparse(args): for line in pipeable.input(args.lines): x = line - pipeable.output(eval(args.eval_string)) + pipeable.stdout(eval(args.eval_string)) def main(argv): parser = argparse.ArgumentParser(description=__doc__) diff --git a/groups_of.py b/groups_of.py index 4b30b04..d348e3c 100644 --- a/groups_of.py +++ b/groups_of.py @@ -10,7 +10,7 @@ def groupsof_argparse(args): chunks = gentools.chunk_generator(lines, args.chunk_size) for chunk in chunks: chunk = args.separator.join(chunk) - pipeable.output(chunk) + pipeable.stdout(chunk) def main(argv): parser = argparse.ArgumentParser(description=__doc__) diff --git a/lowercase.py b/lowercase.py index ad48dc0..fb0f8fb 100644 --- a/lowercase.py +++ b/lowercase.py @@ -2,4 +2,4 @@ from voussoirkit import pipeable for line in pipeable.go(): - pipeable.output(line.lower()) + pipeable.stdout(line.lower()) diff --git a/move_all.py b/move_all.py index 39b11b1..bdc31cc 100644 --- a/move_all.py +++ b/move_all.py @@ -36,7 +36,7 @@ def moveall_argparse(args): return 1 for (file, new_path) in pairs: - pipeable.output(new_path.absolute_path) + pipeable.stdout(new_path.absolute_path) shutil.move(file.absolute_path, new_path.absolute_path) def main(argv): diff --git a/recycle.py b/recycle.py index 1ed96c5..95b1576 100644 --- a/recycle.py +++ b/recycle.py @@ -7,5 +7,5 @@ from voussoirkit import winglob for pattern in pipeable.go(skip_blank=True): for name in winglob.glob(pattern): name = os.path.abspath(name) - pipeable.output(name) + pipeable.stdout(name) send2trash.send2trash(name) diff --git a/replace.py b/replace.py index 9dac3a4..d265415 100644 --- a/replace.py +++ b/replace.py @@ -8,4 +8,4 @@ replace_from = sys.argv[2] replace_to = sys.argv[3] for line in lines: - pipeable.output(line.replace(replace_from, replace_to)) + pipeable.stdout(line.replace(replace_from, replace_to)) diff --git a/sorted.py b/sorted.py index 4675411..db99d6d 100644 --- a/sorted.py +++ b/sorted.py @@ -12,7 +12,7 @@ def sorted_argparse(args): lines.sort() for line in lines: - pipeable.output(line) + pipeable.stdout(line) def main(argv): parser = argparse.ArgumentParser(description=__doc__) diff --git a/sum.py b/sum.py index 6b14f23..f7d1e5a 100644 --- a/sum.py +++ b/sum.py @@ -2,4 +2,4 @@ from voussoirkit import pipeable total = sum(float(x) for x in pipeable.go() if x.strip()) -pipeable.output(f'{total}\n') +pipeable.stdout(f'{total}\n') diff --git a/tempeditor.py b/tempeditor.py index 9b0480a..778e605 100644 --- a/tempeditor.py +++ b/tempeditor.py @@ -72,7 +72,7 @@ def tempeditor_argparse(args): initial_text = '\n'.join(pipeable.input(args.initial_text)) if args.initial_text else None try: text = tempeditor(initial_text=initial_text) - pipeable.output(text) + pipeable.stdout(text) return 0 except NoEditor as exc: pipeable.stderr(exc) diff --git a/touch.py b/touch.py index fac9dab..05ffdc0 100644 --- a/touch.py +++ b/touch.py @@ -15,11 +15,11 @@ def touch_argparse(args): if len(filenames) == 0 and not winglob.is_glob(pattern): open(pattern, 'a').close() - print(pattern) + pipeable.stdout(pattern) for filename in filenames: os.utime(filename) - print(filename) + pipeable.stdout(filename) def main(argv): parser = argparse.ArgumentParser(description=__doc__) diff --git a/unique.py b/unique.py index 9356cc5..e548634 100644 --- a/unique.py +++ b/unique.py @@ -8,7 +8,7 @@ def unique_argparse(args): seen = set() for line in lines: if line not in seen: - pipeable.output(line) + pipeable.stdout(line) seen.add(line) def main(argv):