This commit is contained in:
Your Name
2025-04-28 21:54:11 +12:00
parent 95e705b426
commit 320fd1f3f0
3 changed files with 17 additions and 7 deletions

View File

@ -85,6 +85,9 @@ std::string safearg(int argc, char *argv[], int index)
}
int main(int argc, char* argv[]) {
if (safearg(argc,argv,1) == "hash") return dropshell::hash_demo_raw(safearg(argc,argv,2));
try {
// silently attempt to load the config file.
dropshell::gConfig().load_config();
@ -192,12 +195,6 @@ int main(int argc, char* argv[]) {
return dropshell::main_commands::restore(argvec);
}
if (cmd == "hash") {
if (argc < 3) return die("Error: hash requires a directory to hash");
dropshell::hash_demo(argvec[2]);
return 0;
}
// handle running a command.
std::set<std::string> commands;
dropshell::get_all_used_commands(commands);
@ -230,7 +227,8 @@ int main(int argc, char* argv[]) {
std::cerr << "Error: Unknown command '" << cmd << "'" << std::endl;
std::cerr << "Valid commands: ";
for (const auto& command : commands) {
std::cerr << command << " ";
if (!command.empty() && command[0]!='_')
std::cerr << command << " ";
}
std::cerr << std::endl;
return 1;