summaryrefslogtreecommitdiff
path: root/Source/Applications/Shell/Applets
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Applications/Shell/Applets')
-rw-r--r--Source/Applications/Shell/Applets/mkdir.cpp17
-rw-r--r--Source/Applications/Shell/Applets/rm.cpp17
2 files changed, 34 insertions, 0 deletions
diff --git a/Source/Applications/Shell/Applets/mkdir.cpp b/Source/Applications/Shell/Applets/mkdir.cpp
new file mode 100644
index 0000000..56908d3
--- /dev/null
+++ b/Source/Applications/Shell/Applets/mkdir.cpp
@@ -0,0 +1,17 @@
+#include <App/ShellApp.proto.h>
+#include <Binding/FSNode.class.h>
+
+class mkdir : public ShellApp {
+ public:
+ mkdir() : ShellApp("mkdir", "Create a/some directory/ies") {}
+ int run() {
+ if (args.size() == 0) outvt << "Usage: mkdir <name> [<name> ...]\n";
+ for (u32int i = 0; i < args.size(); i++) {
+ if (!FS::mkdir(args[i], FS::cwdNode()).valid()) {
+ outvt << "Error while creating directory " << args[i] << "\n";
+ }
+ }
+ }
+};
+
+APP(mkdir);
diff --git a/Source/Applications/Shell/Applets/rm.cpp b/Source/Applications/Shell/Applets/rm.cpp
new file mode 100644
index 0000000..4dbb4ed
--- /dev/null
+++ b/Source/Applications/Shell/Applets/rm.cpp
@@ -0,0 +1,17 @@
+#include <App/ShellApp.proto.h>
+#include <Binding/FSNode.class.h>
+
+class rm : public ShellApp {
+ public:
+ rm() : ShellApp("rm", "Remove a/some file(s)/directorie(s)") {}
+ int run() {
+ if (args.size() == 0) outvt << "Usage : rm <file> [<file> ...]\n";
+ for (u32int i = 0; i < args.size(); i++) {
+ if (!FS::find(args[i], FS::cwdNode()).remove()) {
+ outvt << "Error while removing file " << args[i] << "\n";
+ }
+ }
+ }
+};
+
+APP(rm);