pub struct PlaygroundGuard { /* private fields */ }Expand description
Guard that keeps real-mode lesson commands inside the playground.
Implementations§
Source§impl PlaygroundGuard
impl PlaygroundGuard
Sourcepub fn new(root: impl Into<PathBuf>) -> Self
pub fn new(root: impl Into<PathBuf>) -> Self
Create a guard for the given playground root (absolute path).
Sourcepub fn with_display(
root: impl Into<PathBuf>,
display: impl Into<String>,
) -> Self
pub fn with_display( root: impl Into<PathBuf>, display: impl Into<String>, ) -> Self
Create a guard whose refusal messages name the root as display
(e.g. ~/ArcAcademy/home).
Sourcepub fn check_catastrophic(command: &str) -> GuardVerdict
pub fn check_catastrophic(command: &str) -> GuardVerdict
Check only the catastrophic-pattern denylist, with no containment. Used by the free shell when safe mode is off: commands may touch the whole filesystem, but never the handful that destroy it.
Sourcepub fn check(&self, command: &str, cwd: &Path) -> GuardVerdict
pub fn check(&self, command: &str, cwd: &Path) -> GuardVerdict
Check a command line before it is sent to the real shell.
cwd is the tracked working directory for the practice session; it
must be inside the playground root. The check is purely lexical — it
never touches the filesystem.
Sourcepub fn check_expanded(&self, command: &str, cwd: &Path) -> GuardVerdict
pub fn check_expanded(&self, command: &str, cwd: &Path) -> GuardVerdict
Check a line the app has already expanded and quoted itself (see
shell_syntax::render): every word is a literal, and the only $
left is inside single quotes or the shell’s own "$?". Such a line
shows exactly what will run, so $ is no reason to refuse it.
Command substitution is still refused.