diff --git a/getpkg/src/main.cpp b/getpkg/src/main.cpp index 3e75cd2..f17c335 100644 --- a/getpkg/src/main.cpp +++ b/getpkg/src/main.cpp @@ -415,12 +415,58 @@ int uninstall_tool(int argc, char* argv[]) { return 0; } +void show_help() { + std::cout << "getpkg - Package manager for dropshell tools" << std::endl; + std::cout << "Version: " << dropshell::VERSION << std::endl; + std::cout << std::endl; + std::cout << "USAGE:" << std::endl; + std::cout << " getpkg Install/update the specified tool" << std::endl; + std::cout << " getpkg [args...] Run a specific command" << std::endl; + std::cout << std::endl; + std::cout << "COMMANDS:" << std::endl; + std::cout << " install Install or update a tool" << std::endl; + std::cout << " Downloads and installs the tool from getpkg.xyz" << std::endl; + std::cout << " Updates if a newer version is available" << std::endl; + std::cout << std::endl; + std::cout << " uninstall Remove an installed tool" << std::endl; + std::cout << " Removes tool files, PATH entries, and autocomplete" << std::endl; + std::cout << std::endl; + std::cout << " publish Upload a tool to getpkg.xyz" << std::endl; + std::cout << " ARCH is optional (defaults to 'universal')" << std::endl; + std::cout << " Requires SOS_WRITE_TOKEN environment variable" << std::endl; + std::cout << std::endl; + std::cout << " update Update getpkg and all installed tools" << std::endl; + std::cout << std::endl; + std::cout << " create Create a new tool project" << std::endl; + std::cout << " Creates directory structure and setup script" << std::endl; + std::cout << std::endl; + std::cout << " version Show getpkg version" << std::endl; + std::cout << std::endl; + std::cout << " help Show this help message" << std::endl; + std::cout << std::endl; + std::cout << "EXAMPLES:" << std::endl; + std::cout << " getpkg ripgrep Install ripgrep tool" << std::endl; + std::cout << " getpkg install myapp Install myapp (legacy syntax)" << std::endl; + std::cout << " getpkg publish myapp:x86_64 ./build Publish architecture-specific build" << std::endl; + std::cout << " getpkg publish myapp ./build Publish universal build" << std::endl; + std::cout << " getpkg uninstall myapp Remove myapp from system" << std::endl; + std::cout << " getpkg update Update everything" << std::endl; + std::cout << std::endl; + std::cout << "ENVIRONMENT:" << std::endl; + std::cout << " SOS_WRITE_TOKEN Auth token for publishing tools" << std::endl; + std::cout << std::endl; + std::cout << "FILES:" << std::endl; + std::cout << " ~/.bashrc_getpkg Tool PATH and autocomplete setup" << std::endl; + std::cout << " ~/.config/getpkg/ Tool metadata and configs" << std::endl; + std::cout << " ~/.local/bin/getpkg/ Installed tool binaries" << std::endl; +} + } // end anonymous namespace int main(int argc, char* argv[]) { if (argc < 2) { - std::cout << "Usage: getpkg | [args...]" << std::endl; - return 1; + show_help(); + return 0; } std::string command = argv[1]; if (command == "install") { @@ -446,15 +492,7 @@ help } else if (command == "create") { return create_tool(argc, argv); } else if (command == "help") { - std::cout << "Usage: getpkg | [args...]" << std::endl; - std::cout << "Commands:" << std::endl; - std::cout << " Install/update the specified tool" << std::endl; - std::cout << " install Install/update tool (legacy)" << std::endl; - std::cout << " uninstall Uninstall the specified tool" << std::endl; - std::cout << " publish Publish a tool (ARCH optional)" << std::endl; - std::cout << " update Update getpkg and all tools" << std::endl; - std::cout << " version Show getpkg version" << std::endl; - std::cout << " create Create new tool directory" << std::endl; + show_help(); } else { // Assume it's a tool name and install it char* fakeArgv[] = {argv[0], (char*)"install", argv[1]};