Skip to content

Commit 1190c1e

Browse files
committed
Final tweaks to make_structure.py
1 parent b661e87 commit 1190c1e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

make_structure.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
"""
22
This script takes tab delimited input file like so and automatically
3-
creates the folder structure along with empty README files, per the contributing
4-
guidelines. If you copy-paste from Google sheets, it will automatically add
5-
tabs.
3+
creates the folder structure for readings along with empty README files, per the
4+
contributing guidelines. If you copy-paste from Google sheets, it will
5+
automatically add tabs.
6+
7+
Sorry, didn't feel like handling labs, so you just need to delete the lab folder
8+
when it gets created or rename it manually.
69
710
* Copy-paste the file below into `outline.txt` (too lazy to parameterize this
811
script) in the directory of the module that you want to use, i.e.,
912
`module5-testing/outline.txt`
1013
* cd to the correct directory (this step is important for the working directory
1114
to be correct)
12-
* Run `python ../make_structure.py`
15+
* Run `python3 ../make_structure.py` (not python2)
1316
* Enjoy your created structure
1417
1518
1 What is a test?
@@ -35,13 +38,10 @@ def main():
3538
# Convert casing: "Example code" to "example-code"
3639
normalized_chapter_name = chapter_name.replace(' ', '-').lower()
3740
# Make directories
38-
subprocess.run(["mkdir", "-p", os.path.join(
39-
chapter_num,
40-
os.getcwd(),
41-
normalized_chapter_name)])
41+
dir_name = chapter_num.strip() + '-' + normalized_chapter_name.strip()
42+
subprocess.run(["mkdir", "-p", os.path.join(os.getcwd(), dir_name)])
4243
# Make README files
43-
subprocess.run(["touch", os.path.join(os.getcwd(), normalized_chapter_name,
44-
"README.md")])
44+
subprocess.run(["touch", os.path.join(os.getcwd(), dir_name, "README.md")])
4545

4646
if __name__ == '__main__':
4747
main()

0 commit comments

Comments
 (0)