summaryrefslogtreecommitdiffstats
path: root/src/poem/anthology/cd.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/poem/anthology/cd.rs')
-rw-r--r--src/poem/anthology/cd.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/poem/anthology/cd.rs b/src/poem/anthology/cd.rs
index d3a1998..5b39359 100644
--- a/src/poem/anthology/cd.rs
+++ b/src/poem/anthology/cd.rs
@@ -1,6 +1,17 @@
use crate::poem::Verse;
use std::env;
+/// cd
+///
+/// The builtin `cd` command. Used to change directories. This must be
+/// implemented by the shell, since the `pwd` is context sensitive within a
+/// process. If no arguments are given, `cd` will take the user back to their
+/// home directory (i.e. `~`).
+///
+/// # Shell Example
+/// ```sh
+/// cd ~/.config # Change into /home/<user>/.config
+/// ```
pub fn incant(verse: &Verse) -> i32 {
let path = match verse.clause() {
Some(path) => path[0].to_string(),