diff --git a/getpkg/src/main.cpp b/getpkg/src/main.cpp index c9bb0e4..16abbf0 100644 --- a/getpkg/src/main.cpp +++ b/getpkg/src/main.cpp @@ -20,6 +20,14 @@ getpkg install - legacy syntax for installing a tool (same as getpkg ) + getpkg uninstall + - uninstalls the specified tool + - removes the tool from the user's system + - removes the tool's entries in the ~/.bashrc_getpkg script + - removes the tool's entry in the autocomplete function in the ~/.bashrc_getpkg script + - removes the tool's entry in the ~/.config/getpkg/tool_name.json file + - removes the tool's directory from ~/.local/bin/getpkg/ + getpkg publish - creates a tgz archive of the folder, and uploads it to getpkg.xyz, a simple object server. - prints the URL and hash of the uploaded archive diff --git a/getpkg/test.sh b/getpkg/test.sh index 24debab..3eda8e9 100755 --- a/getpkg/test.sh +++ b/getpkg/test.sh @@ -34,7 +34,12 @@ print_test_result() { } # Function to cleanup test artifacts +CLEANED=0 cleanup() { + if [ "$CLEANED" -eq 1 ]; then + return + fi + CLEANED=1 echo -e "\n${YELLOW}Cleaning up test artifacts...${NC}" # Remove local test directories @@ -43,9 +48,10 @@ cleanup() { rm -rf ~/.local/bin/getpkg/"${TEST_TOOL_NAME}" 2>/dev/null || true # Remove test tool from bashrc_getpkg if it exists - if [ -f ~/.bashrc_getpkg ]; then - sed -i "/${TEST_TOOL_NAME}/d" ~/.bashrc_getpkg 2>/dev/null || true - fi + # if [ -f ~/.bashrc_getpkg ]; then + # sed -i "/${TEST_TOOL_NAME}/d" ~/.bashrc_getpkg 2>/dev/null || true + # fi + $GETPKG uninstall "$TEST_TOOL_NAME" 2>/dev/null || true # Clean up from getpkg.xyz if we have write access if [ -n "${SOS_WRITE_TOKEN:-}" ]; then @@ -334,6 +340,8 @@ else echo -e "\n${YELLOW}Skipping update all test (no tools installed)${NC}" fi +cleanup + # Print summary echo -e "\n${YELLOW}Test Summary:${NC}" echo -e "Tests passed: ${GREEN}${TESTS_PASSED}${NC}" @@ -345,4 +353,5 @@ if [ "$TESTS_FAILED" -eq 0 ]; then else echo -e "\n${RED}Some tests failed!${NC}" exit 1 -fi \ No newline at end of file +fi +