summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index d167d04..3c016e9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -116,6 +116,23 @@ impl Poem {
exit(0);
}
+ if verse.verb() == "cd" {
+ let path: String;
+ if verse.clause().is_empty() {
+ path = env!("HOME").to_string();
+ } else {
+ path = verse.clause().first().unwrap().to_owned();
+ }
+
+ match std::env::set_current_dir(&path) {
+ Ok(_) => continue,
+ Err(_) => {
+ println!("cd: unable to change into {}", path);
+ continue;
+ }
+ }
+ }
+
if !verse.spellcheck(bins) {
*bins = prefresh(paths);
if !verse.spellcheck(bins) {