diff --git a/dshash/dshash b/dshash/dshash index 1cc8e6f..9195cd4 100755 Binary files a/dshash/dshash and b/dshash/dshash differ diff --git a/dshash/main.cpp b/dshash/main.cpp index 1c7b30d..998f235 100644 --- a/dshash/main.cpp +++ b/dshash/main.cpp @@ -9,20 +9,42 @@ void printUsage(const std::string& program) { std::cerr << "Usage: " << program << " [-v] \n"; std::cerr << " " << program << " version\n"; + std::cerr << " " << program << " autocomplete \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; diff --git a/dshash/main.o b/dshash/main.o index 18cf7db..7d8f501 100644 Binary files a/dshash/main.o and b/dshash/main.o differ