__resources__ = {"README.md": "README.md"} from exercise_utils.file import create_or_update_file from exercise_utils.git import add, checkout, commit from exercise_utils.gitmastery import create_start_tag def setup(verbose: bool = False): create_start_tag(verbose) # feature/login branch checkout("feature/login", True, verbose) create_or_update_file( "src/login.js", """ function login(username, password) { return username === "admin" && password == "admin" } """, ) add(["src/login.js"], verbose) commit("Add login script", verbose) create_or_update_file( "login.html", """ Login

Login

""", ) add(["login.html"], verbose) commit("Add login page", verbose) checkout("main", False, verbose) # feature/dashboard branch checkout("feature/dashboard", True, verbose) create_or_update_file( "dashboard.html", """ Dashboard

User Dashboard

""", ) add(["dashboard.html"], verbose) commit("Add dashboard header", verbose) create_or_update_file( "dashboard.html", """ Dashboard

User Dashboard

Welcome back, user!

Your account is in good standing.

""", ) add(["dashboard.html"], verbose) commit("Add dashboard body", verbose) create_or_update_file( "dashboard.html", """ Dashboard

User Dashboard

Welcome back, user!

Your account is in good standing.

""", ) add(["dashboard.html"], verbose) commit("Add dashboard footer", verbose) checkout("main", False, verbose) # feature/payments branch checkout("feature/payments", True, verbose) create_or_update_file( "src/payments.js", """ function processPayment(cardNumber, amount) { // Simulated payment logic return `Charged $${amount} to card ending in ${cardNumber.slice(-4)}`; } """, ) add(["src/payments.js"], verbose) commit("Add payments script", verbose) create_or_update_file( "payments.html", """ Payments

Make a Payment

""", ) add(["payments.html"], verbose) commit("Add payments page", verbose) checkout("main", False, verbose)