diff options
author | Your Name <you@example.com> | 2021-05-06 17:00:00 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-05-06 17:00:00 -0400 |
commit | bf6db4e57895430d84503e800cec9e8b407212a8 (patch) | |
tree | bc21559fc0bff2ad616c5d69a45b5a22cc8cea60 /src/dmtool.cc | |
parent | 5ed030a38810e4a3bb9c969db6892065581340c6 (diff) | |
download | dmtool-bf6db4e57895430d84503e800cec9e8b407212a8.tar.gz dmtool-bf6db4e57895430d84503e800cec9e8b407212a8.tar.bz2 dmtool-bf6db4e57895430d84503e800cec9e8b407212a8.zip |
Added a real configuration file (plus a dependency on libconfuse)
Diffstat (limited to 'src/dmtool.cc')
-rw-r--r-- | src/dmtool.cc | 23 |
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); |