Skip to content

Commit f298251

Browse files
committed
[hp-diff-files] Implement hp-diff-files
1 parent df4d90a commit f298251

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

hands_on/diff_files.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import os
2+
3+
from exercise_utils.file import create_or_update_file, append_to_file
4+
from exercise_utils.git import add, init, commit
5+
6+
__requires_git__ = True
7+
__requires_github__ = False
8+
9+
10+
def download(verbose: bool):
11+
os.makedirs("employees")
12+
os.chdir("employees")
13+
init(verbose)
14+
15+
create_or_update_file(
16+
"list.txt",
17+
"""
18+
Andy Bernard
19+
""",
20+
)
21+
os.makedirs("andy")
22+
create_or_update_file(
23+
"andy/history.txt",
24+
"""
25+
Previously in Stamford branch
26+
""",
27+
)
28+
add(["."], verbose)
29+
commit("Add Andy", verbose)
30+
31+
append_to_file(
32+
"list.txt",
33+
"""
34+
Pam Beesly
35+
""",
36+
)
37+
add(["."], verbose)
38+
commit("Add Pam", verbose)
39+
40+
append_to_file(
41+
"list.txt",
42+
"""
43+
Kevin Malone
44+
""",
45+
)
46+
add(["."], verbose)
47+
48+
append_to_file(
49+
"list.txt",
50+
"""
51+
Jim Halpert
52+
""",
53+
)
54+
append_to_file(
55+
"andy/history.txt",
56+
"""
57+
Education: Cornell
58+
""",
59+
)

0 commit comments

Comments
 (0)