From ab87fecb399f68d1b0c41e306ae6a5fb8c0565e0 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 22 Jun 2025 11:43:22 +1200 Subject: [PATCH] 'Generic Commit' --- README.md | 6 +----- getpkg/src/main.cpp | 16 +++++++--------- getpkg/test.sh | 16 ++++++++-------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 9eecfde..dd1c93d 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,6 @@ Install any tool from the getpkg registry: ```bash # Install a tool getpkg install ripgrep - -# Shorthand syntax (same as above) -getpkg ripgrep ``` ### Managing Installed Tools @@ -46,8 +43,7 @@ getpkg version ### Core Package Management -- **`getpkg `** - Install or update a tool (shorthand) -- **`getpkg install `** - Install or update a tool (explicit) +- **`getpkg install `** - Install or update a tool - **`getpkg uninstall `** - Remove an installed tool - **`getpkg update`** - Update getpkg and all installed tools diff --git a/getpkg/src/main.cpp b/getpkg/src/main.cpp index 1b715b9..ccc28e7 100644 --- a/getpkg/src/main.cpp +++ b/getpkg/src/main.cpp @@ -1,8 +1,7 @@ /* getpkg - getpkg - - installs the specified tool (same as getpkg install ) + getpkg install - confirms getpkg is fully initialised: - adds a line to the user's .bashrc file to source the getpkg ~/.bashrc_getpkg script, if it doesn't exist - creates an empty ~/.bashrc_getpkg script if it doesn't exist @@ -18,7 +17,7 @@ - if setup_script.sh exists, run the script getpkg install - - legacy syntax for installing a tool (same as getpkg ) + - installs the specified tool getpkg uninstall - uninstalls the specified tool @@ -674,7 +673,6 @@ void show_help() { 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; @@ -709,8 +707,8 @@ void show_help() { 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 install ripgrep Install ripgrep tool" << std::endl; + std::cout << " getpkg install myapp Install myapp" << 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 unpublish myapp:x86_64 Remove published myapp" << std::endl; @@ -768,9 +766,9 @@ help } else if (command == "help") { show_help(); } else { - // Assume it's a tool name and install it - char* fakeArgv[] = {argv[0], (char*)"install", argv[1]}; - return install_tool(3, fakeArgv); + std::cerr << "Unknown command: " << command << std::endl; + std::cerr << "Use 'getpkg help' for usage information." << std::endl; + return 1; } return 0; } \ No newline at end of file diff --git a/getpkg/test.sh b/getpkg/test.sh index 372f51c..095c85f 100755 --- a/getpkg/test.sh +++ b/getpkg/test.sh @@ -313,18 +313,18 @@ if [ -n "${SOS_WRITE_TOKEN:-}" ]; then print_test_result "Bashrc modifications for PATH and autocomplete" 1 fi - # Test 12: Direct tool name install (shortcut syntax) - echo -e "\nTest 12: Direct tool install syntax" + # Test 12: Reinstall after manual removal + echo -e "\nTest 12: Reinstall after manual removal" # First remove the tool rm -rf ~/.getpkg/"${TEST_TOOL_NAME}" rm -rf ~/.local/bin/getpkg/"${TEST_TOOL_NAME}" rm -f ~/.config/getpkg/"${TEST_TOOL_NAME}.json" - DIRECT_INSTALL_OUTPUT=$(timeout 3 "$GETPKG" "$TEST_TOOL_NAME" 2>&1) || DIRECT_INSTALL_OUTPUT="" - if [[ "$DIRECT_INSTALL_OUTPUT" =~ Installed\ ${TEST_TOOL_NAME}\ successfully ]] || [[ "$DIRECT_INSTALL_OUTPUT" =~ ${TEST_TOOL_NAME}\ is\ already\ up\ to\ date ]]; then - print_test_result "Direct tool name install syntax" 0 + REINSTALL_OUTPUT=$(timeout 3 "$GETPKG" install "$TEST_TOOL_NAME" 2>&1) || REINSTALL_OUTPUT="" + if [[ "$REINSTALL_OUTPUT" =~ Installed\ ${TEST_TOOL_NAME}\ successfully ]] || [[ "$REINSTALL_OUTPUT" =~ ${TEST_TOOL_NAME}\ is\ already\ up\ to\ date ]]; then + print_test_result "Reinstall after manual removal" 0 else - print_test_result "Direct tool name install syntax" 1 + print_test_result "Reinstall after manual removal" 1 fi # Test 13: Update already installed tool (should say up to date) @@ -341,7 +341,7 @@ if [ -n "${SOS_WRITE_TOKEN:-}" ]; then # Skip dependent tests print_test_result "Tool files installed correctly" 1 print_test_result "Bashrc modifications for PATH and autocomplete" 1 - print_test_result "Direct tool name install syntax" 1 + print_test_result "Reinstall after manual removal" 1 print_test_result "Update check recognizes up-to-date tool" 1 fi @@ -352,7 +352,7 @@ if [ -n "${SOS_WRITE_TOKEN:-}" ]; then print_test_result "Install tool from getpkg.xyz" 1 print_test_result "Tool files installed correctly" 1 print_test_result "Bashrc modifications for PATH and autocomplete" 1 - print_test_result "Direct tool name install syntax" 1 + print_test_result "Reinstall after manual removal" 1 print_test_result "Update check recognizes up-to-date tool" 1 fi