aboutsummaryrefslogtreecommitdiff
path: root/src/dmtool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dmtool.cc')
-rw-r--r--src/dmtool.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/dmtool.cc b/src/dmtool.cc
index 30f73b5..3c5d3a1 100644
--- a/src/dmtool.cc
+++ b/src/dmtool.cc
@@ -41,18 +41,19 @@ std::vector<std::string> extractFlags(std::vector<std::string>& args) {
}
int main(int argc, char *argv[]) {
- std::string exename = argv[0];
- std::vector<std::string> args(&argv[1], &argv[argc]);
- std::vector<std::string> flags = extractFlags(args);
- cmd::mkdir({cmd::getTruePath("")});
- if(args.empty()) {
- std::cout << cmd::list(args);
- return 0;
- }
- std::string cmd = args[0];
- std::vector<std::string> argsOrig(args);
- args.erase(args.begin());
+ // Full thing is surrounded in try/catch to pleasantly print out any errors
try {
+ std::string exename = argv[0];
+ std::vector<std::string> args(&argv[1], &argv[argc]);
+ std::vector<std::string> flags = extractFlags(args);
+ cmd::mkdir({cmd::getTruePath("")});
+ if(args.empty()) {
+ std::cout << cmd::list(args);
+ return 0;
+ }
+ std::string cmd = args[0];
+ std::vector<std::string> argsOrig(args);
+ args.erase(args.begin());
checkArgs(cmd, args);
if(cmd == "ls") std::cout << cmd::list(args);
else if(cmd == "cp") std::cout << cmd::cp(args);