From c419a127dd6b5538d4911194558672d433be7c61 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Fri, 4 Jan 2019 10:37:48 -0600 Subject: [PATCH] move chapters to an occasional scripts folder --- chapters.py | 13 ------------- chapters.sh | 2 -- occasional-scripts/chapters.py | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 chapters.py delete mode 100755 chapters.sh create mode 100644 occasional-scripts/chapters.py diff --git a/chapters.py b/chapters.py deleted file mode 100644 index e4bd540..0000000 --- a/chapters.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function, unicode_literals -import sys - -task_templates = [ - "read {}", - "make chapter summary for {}", - "make flashcards for {}", -] - -for line in sys.stdin.readlines(): - for template in task_templates: - print(template.format(line.strip())) diff --git a/chapters.sh b/chapters.sh deleted file mode 100755 index 4f9cf17..0000000 --- a/chapters.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -seq 1 ${1} | tr ' ' '\n' | sed -E 's/^/chapter /g' | python chapters.py diff --git a/occasional-scripts/chapters.py b/occasional-scripts/chapters.py new file mode 100644 index 0000000..c8eb26b --- /dev/null +++ b/occasional-scripts/chapters.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +from __future__ import print_function, unicode_literals +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument('num_chapters', type=int) +args = parser.parse_args() + +task_templates = [ + "read chapter {}", + "make chapter summary for chapter {}", + "make flashcards for chapter {}", +] + +for i in range(1, args.num_chapters+1): + for template in task_templates: + print(template.format(i))