summaryrefslogtreecommitdiffstats
path: root/src/poem/anthology/cd.rs
diff options
context:
space:
mode:
authorRory Dudley2024-03-31 00:50:03 -0600
committerRory Dudley2024-03-31 00:50:03 -0600
commit791b61f97e3ee12dfd765f5e23edd5df527eb803 (patch)
treebeec5cfab87229b84897aa038b514e08d4532665 /src/poem/anthology/cd.rs
parentf03f4e0fcf62c9b3267bc5d8b62068d89ec593cd (diff)
downloaddwarvish-791b61f97e3ee12dfd765f5e23edd5df527eb803.tar.gz
Add docstring comments to all the anthology functions
Add docstring comments for all the incant function throughout the anthology, documenting what each function does, and an example of it's shell command.
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(),