feat: Update 3 files
This commit is contained in:
BIN
dshash/dshash
BIN
dshash/dshash
Binary file not shown.
@@ -9,20 +9,42 @@
|
||||
void printUsage(const std::string& program) {
|
||||
std::cerr << "Usage: " << program << " [-v] <file_or_directory_path>\n";
|
||||
std::cerr << " " << program << " version\n";
|
||||
std::cerr << " " << program << " autocomplete <args>\n";
|
||||
std::cerr << " -v Verbose mode (list files as they are processed)\n";
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc < 2 || argc > 3) {
|
||||
if (argc < 2) {
|
||||
printUsage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Check for version command
|
||||
if (argc == 2 && std::string(argv[1]) == "version") {
|
||||
std::cout << DSHASH_VERSION << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check for autocomplete command
|
||||
if (std::string(argv[1]) == "autocomplete") {
|
||||
// Return available options for autocomplete
|
||||
std::cout << "-v\n";
|
||||
std::cout << "version\n";
|
||||
// Suggest files and directories in current directory
|
||||
try {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(".")) {
|
||||
std::cout << entry.path().filename().string() << "\n";
|
||||
}
|
||||
} catch (...) {
|
||||
// Ignore errors in autocomplete
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc > 3) {
|
||||
printUsage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool verbose = false;
|
||||
std::string path;
|
||||
|
BIN
dshash/main.o
BIN
dshash/main.o
Binary file not shown.
Reference in New Issue
Block a user