Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions hands_on/diff_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import os

from exercise_utils.file import create_or_update_file, append_to_file
from exercise_utils.git import add, init, commit

__requires_git__ = True
__requires_github__ = False


def download(verbose: bool):
os.makedirs("employees")
os.chdir("employees")
init(verbose)

create_or_update_file(
"list.txt",
"""
Andy Bernard
""",
)
os.makedirs("andy")
create_or_update_file(
"andy/history.txt",
"""
Previously in Stamford branch
""",
)
add(["."], verbose)
commit("Add Andy", verbose)

append_to_file(
"list.txt",
"""
Pam Beesly
""",
)
add(["."], verbose)
commit("Add Pam", verbose)

append_to_file(
"list.txt",
"""
Kelly Kapoor
""",
)
add(["."], verbose)
commit("Add Kelly", verbose)

append_to_file(
"list.txt",
"""
Kevin Malone
""",
)
add(["."], verbose)

append_to_file(
"list.txt",
"""
Jim Halpert
""",
)
append_to_file(
"andy/history.txt",
"""
Education: Cornell
""",
)