From 308674520aaa9cd70a52b1ec8a5ebf8f4def3078 Mon Sep 17 00:00:00 2001 From: Vikram Goyal Date: Sun, 26 Oct 2025 14:58:11 +0800 Subject: [PATCH 1/2] Implement hands on hp-add-remote --- hands_on/add_remote.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 hands_on/add_remote.py diff --git a/hands_on/add_remote.py b/hands_on/add_remote.py new file mode 100644 index 0000000..ad7af2b --- /dev/null +++ b/hands_on/add_remote.py @@ -0,0 +1,40 @@ +import os + +from exercise_utils.git import add, init, commit +from exercise_utils.file import create_or_update_file, append_to_file + +__requires_git__ = True +__requires_github__ = False + + +def download(verbose: bool): + os.makedirs("things") + os.chdir("things") + init(verbose) + create_or_update_file( + "fruits.txt", + """ + apples + bananas + cherries + dragon fruits + figs + """, + ) + add(["fruits.txt"], verbose) + append_to_file("fruits.txt", """ + figs + """, + ) + add(["fruits.txt"], verbose) + commit("Insert figs into fruits.txt", verbose) + create_or_update_file("colours.txt", """ + a file for colours + """, + ) + create_or_update_file("shapes.txt", """ + a file for shapes + """, + ) + add(["colours.txt", "shapes.txt"], verbose) + commit("Add colours.txt, shapes.txt", verbose) From d72e1dd749815a68b12b5efec42e6c0d85810546 Mon Sep 17 00:00:00 2001 From: Vikram Goyal Date: Thu, 30 Oct 2025 16:50:26 +0800 Subject: [PATCH 2/2] Change multiline to single line --- hands_on/add_remote.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hands_on/add_remote.py b/hands_on/add_remote.py index ad7af2b..3c46a58 100644 --- a/hands_on/add_remote.py +++ b/hands_on/add_remote.py @@ -22,10 +22,7 @@ def download(verbose: bool): """, ) add(["fruits.txt"], verbose) - append_to_file("fruits.txt", """ - figs - """, - ) + append_to_file("fruits.txt", "figs") add(["fruits.txt"], verbose) commit("Insert figs into fruits.txt", verbose) create_or_update_file("colours.txt", """