Welcome back to Day 4 of our journey building a custom shell from scratch using Rust! Today, we're diving deep into the complexities of argument parsing, handling single and double quotes, and mastering escape characters.
If you've ever wondered how your favorite shell (like Bash or Fish) handles complex user inputs, this stream is for you. We’re refactoring our logic to use a more scalable state-machine approach with Enums and Match statements, all while navigating the quirks of POSIX compliance.
In this stream, we cover:
Refactoring argument parsing for better clarity.
Implementing a state-driven approach for quoted text.
Handling the nuances of backslash escapes in different quote modes.
A look into the "Lexer vs. Parser" architecture.
Community Q&A on Rust, career paths, and staying motivated as a developer.
Join this channel to get access to perks:
/ @bashbunni
bashbunni is partnered with Tailscale! Tailscale leverages the Wireguard protocol to create a user friendly, low latency, peer-to-peer mesh network. It's free for individuals + get three months free off of any paid plan with code 'bashbunni'.
https://link.bashbunni.dev/tailscale
---
In this stream, I'm building a shell with a guided project from Code Crafters. This project is free for the next few months, so you can follow along too!
I have a referral/affiliate link with them that gets you 40% off their annual plan (ignore the 72 hour window, you can redeem this discount indefinitely) https://link.bashbunni.dev/codecrafters
Chapters:
00:00 - Introduction & Stream Setup
01:48 - Discussing Omarchy & Staying Locked In
04:50 - Transitioning to the Linux Machine
07:45 - The Sunday Refactor Disaster (Git Lessons)
11:15 - Managing YouTube Chat & Community Shoutouts
13:15 - Current State: Refactoring with Match & Enums
19:15 - Researching Tokenizers, Lexers, and Parsers
24:00 - "Crafting Interpreters" & Learning Resources
29:45 - Side Quest: Looking at the Fish Shell Source Code
39:00 - Architectural Review: Improving Parse Logic
50:50 - The Importance of Refactoring Without AI
53:50 - The "Anti-AI Pope" Memes & Tech Philosophy
01:03:00 - Why I Use Doom Emacs (Vim Keybinds & Customization)
01:13:30 - Implementing the New State Machine Logic
01:21:40 - Coding Methodology: Variables vs. Comments
01:43:00 - Career Advice: Degrees, Experience, and Imposter Syndrome
01:47:15 - Tips for Staying Motivated & Curious
02:04:30 - Debugging Backslashes in Double Quotes
02:30:30 - The Struggle of Test-Driven Development (TDD)
02:43:30 - Wrapping Up & Planning for Day 5
#Rust #Coding #SoftwareEngineering #LearnToCode #RustLang #ShellDevelopment