From 9a09c0bfc5956ed57fa4c26f84babb6778fa8a34 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 1 Sep 2026 07:58:49 +0000 Subject: path --- src/command/builtin.cc | 3 ++- src/command/cd.cc | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/command/cd.cc (limited to 'src/command') diff --git a/src/command/builtin.cc b/src/command/builtin.cc index 917dee4..4c5c1e2 100644 --- a/src/command/builtin.cc +++ b/src/command/builtin.cc @@ -13,7 +13,8 @@ unordered_map> cmd = { "exit", ov4::command::exit }, { "jobs", ov4::command::jobs }, { "bg", ov4::command::bg }, - { "fg", ov4::command::fg } + { "fg", ov4::command::fg }, + { "cd", ov4::command::cd }, }; /* diff --git a/src/command/cd.cc b/src/command/cd.cc new file mode 100644 index 0000000..49b1899 --- /dev/null +++ b/src/command/cd.cc @@ -0,0 +1,19 @@ +#include "command/builtin.h" + +namespace ov4::command +{ + +using namespace std; + +void cd(char **argv) +{ + if (argv == nullptr) return; + if (argv[1] == nullptr) + { + cout << "cd: requires path" << endl; + return; + } + ov4::set_current_dir(argv[1]); +} + +} -- cgit v1.3.1-4-g156e