Compare commits
4 Commits
v2025.0719
...
v2025.0720
Author | SHA1 | Date | |
---|---|---|---|
6a3ca6bc10 | |||
7f8312ed59 | |||
1b03087c02 | |||
0ba6227412 |
278
README.md
278
README.md
@ -1,192 +1,86 @@
|
|||||||
# getpkg - Package Manager for Dropshell Tools
|
# getpkg - Simple Package Manager
|
||||||
|
|
||||||
getpkg is a command-line package manager that simplifies tool installation, management, and publishing for the dropshell ecosystem. Tools are installed to `~/.getpkg/` with executable symlinks in `~/.local/bin/getpkg/` and automatically added to your PATH with bash completion.
|
getpkg is a command-line package manager that makes it easy to install and manage developer tools. Tools are automatically installed to your home directory and added to your PATH.
|
||||||
|
|
||||||
## Installation
|
## Quick Start
|
||||||
|
|
||||||
Install getpkg with a single command:
|
Install getpkg with one command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl https://getbin.xyz/getpkg-install | bash
|
curl https://getbin.xyz/getpkg-install | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
After installation, restart your shell or run `source ~/.bashrc` to enable the new PATH and completion settings.
|
After installation, restart your shell or run:
|
||||||
|
```bash
|
||||||
## Basic Usage
|
source ~/.bashrc
|
||||||
|
```
|
||||||
### Installing Tools
|
|
||||||
|
## Basic Commands
|
||||||
Install any tool from the getpkg registry:
|
|
||||||
|
### Install Tools
|
||||||
```bash
|
```bash
|
||||||
# Install a tool
|
getpkg install <tool_name> # Install a tool
|
||||||
getpkg install whatsdirty
|
getpkg list # See all available tools
|
||||||
```
|
getpkg update # Update all installed tools
|
||||||
|
```
|
||||||
### Managing Installed Tools
|
|
||||||
|
### Manage Tools
|
||||||
```bash
|
```bash
|
||||||
# List all available commands
|
getpkg uninstall <tool_name> # Remove a tool
|
||||||
getpkg help
|
getpkg version # Check getpkg version
|
||||||
|
getpkg help # Show all commands
|
||||||
# Update all installed tools
|
```
|
||||||
getpkg update
|
|
||||||
|
## Popular Tools
|
||||||
# Uninstall a tool
|
|
||||||
getpkg uninstall whatsdirty
|
Install these useful developer tools:
|
||||||
|
|
||||||
# Check getpkg version
|
```bash
|
||||||
getpkg version
|
getpkg install bb64 # Bash-compatible base64 encoder/decoder
|
||||||
```
|
getpkg install dehydrate # Convert files to C++ source code
|
||||||
|
getpkg install whatsdirty # Check git repository status
|
||||||
## Available Commands
|
getpkg install sos # Simple object storage client
|
||||||
|
getpkg install gp # Git push utility
|
||||||
### Core Package Management
|
```
|
||||||
|
|
||||||
- **`getpkg install <tool_name>`** - Install or update a tool
|
## How It Works
|
||||||
- **`getpkg uninstall <tool_name>`** - Remove an installed tool
|
|
||||||
- **`getpkg update`** - Update getpkg and all installed tools
|
When you install a tool:
|
||||||
|
1. Downloads from getpkg.xyz
|
||||||
### Publishing (Requires SOS_WRITE_TOKEN)
|
2. Installs to `~/.getpkg/<tool_name>/`
|
||||||
|
3. Creates shortcuts in `~/.local/bin/getpkg/`
|
||||||
- **`getpkg publish <tool_name[:ARCH]> <folder>`** - Upload a tool to getpkg.xyz
|
4. Adds to your PATH automatically
|
||||||
- **`getpkg unpublish <tool_name[:ARCH]>`** - Remove a published tool
|
5. Enables bash completion
|
||||||
- **`getpkg unpublish <hash>`** - Remove a published tool by hash
|
|
||||||
|
## File Locations
|
||||||
### Development Tools
|
|
||||||
|
- **Installed tools**: `~/.getpkg/<tool_name>/`
|
||||||
- **`getpkg create <tool_name> <directory>`** - Create a new tool project
|
- **Shortcuts**: `~/.local/bin/getpkg/` (in your PATH)
|
||||||
- **`getpkg hash <file_or_directory>`** - Calculate hash of files/directories
|
- **Settings**: `~/.config/getpkg/`
|
||||||
|
|
||||||
### Information
|
## Architecture Support
|
||||||
|
|
||||||
- **`getpkg list`** - List all available packages with status
|
getpkg automatically downloads the right version for your system:
|
||||||
- **`getpkg clean`** - Clean up orphaned configs and symlinks
|
- Intel/AMD 64-bit (`x86_64`)
|
||||||
- **`getpkg version`** - Show getpkg version
|
- ARM 64-bit (`aarch64`)
|
||||||
- **`getpkg help`** - Show detailed help
|
- Universal (works everywhere)
|
||||||
- **`getpkg autocomplete`** - Show available commands for completion
|
|
||||||
|
## Troubleshooting
|
||||||
## How It Works
|
|
||||||
|
**Tool not found after install?**
|
||||||
### Installation Process
|
```bash
|
||||||
|
source ~/.bashrc
|
||||||
When you install a tool, getpkg:
|
```
|
||||||
|
|
||||||
1. **Downloads** the tool archive from getpkg.xyz
|
**Permission errors?**
|
||||||
2. **Extracts** it to `~/.getpkg/<tool_name>/`
|
getpkg installs to your home directory - no root access needed.
|
||||||
3. **Creates symlinks** for all executables in `~/.local/bin/getpkg/`
|
|
||||||
4. **Ensures PATH** includes `~/.local/bin/getpkg` (one-time setup)
|
**Network issues?**
|
||||||
5. **Enables completion** for the tool
|
Check your internet connection to `getpkg.xyz`.
|
||||||
6. **Runs setup** if a `setup_script.sh` exists
|
|
||||||
7. **Stores metadata** in `~/.config/getpkg/<tool_name>.json`
|
## Need Help?
|
||||||
|
|
||||||
### Architecture Support
|
```bash
|
||||||
|
getpkg help # Show detailed help
|
||||||
getpkg supports multiple architectures:
|
getpkg list # See what's available
|
||||||
- `x86_64` (Intel/AMD 64-bit)
|
```
|
||||||
- `aarch64` (ARM 64-bit)
|
|
||||||
- `universal` (cross-platform tools)
|
|
||||||
|
|
||||||
Tools are automatically downloaded for your architecture, with fallback to universal versions.
|
|
||||||
|
|
||||||
### File Locations
|
|
||||||
|
|
||||||
- **Tool files**: `~/.getpkg/<tool_name>/` (actual tool installation)
|
|
||||||
- **Executable symlinks**: `~/.local/bin/getpkg/` (in your PATH)
|
|
||||||
- **Configuration**: `~/.config/getpkg/`
|
|
||||||
- **PATH setup**: `~/.bashrc_getpkg` (sourced by `~/.bashrc`)
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Installing Popular Tools
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install available tools
|
|
||||||
getpkg install dehydrate # File to C++ code generator
|
|
||||||
getpkg install bb64 # Bash base64 encoder/decoder
|
|
||||||
|
|
||||||
# Development tools (for repository development)
|
|
||||||
getpkg install whatsdirty # Check git repo status
|
|
||||||
getpkg install sos # Simple object storage client
|
|
||||||
getpkg install gp # Git push utility
|
|
||||||
```
|
|
||||||
|
|
||||||
### Publishing Your Own Tools
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Set your publishing token
|
|
||||||
export SOS_WRITE_TOKEN="your-token-here"
|
|
||||||
|
|
||||||
# Create a new tool project
|
|
||||||
getpkg create mytool ./mytool-project
|
|
||||||
|
|
||||||
# Publish architecture-specific build
|
|
||||||
getpkg publish mytool:x86_64 ./build/
|
|
||||||
|
|
||||||
# Publish universal tool
|
|
||||||
getpkg publish mytool ./build/
|
|
||||||
|
|
||||||
# Remove published tool
|
|
||||||
getpkg unpublish mytool:x86_64
|
|
||||||
```
|
|
||||||
|
|
||||||
### Development Workflow
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create tool structure
|
|
||||||
getpkg create awesome-tool ./awesome-tool
|
|
||||||
cd awesome-tool
|
|
||||||
|
|
||||||
# Build your tool...
|
|
||||||
# Add executable to the directory
|
|
||||||
|
|
||||||
# Test locally
|
|
||||||
./awesome-tool --version
|
|
||||||
|
|
||||||
# Publish when ready
|
|
||||||
getpkg publish awesome-tool:x86_64 .
|
|
||||||
```
|
|
||||||
|
|
||||||
## Environment Variables
|
|
||||||
|
|
||||||
- **`SOS_WRITE_TOKEN`** - Authentication token for publishing tools
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Tool Not Found
|
|
||||||
If a tool isn't found after installation, ensure your shell has loaded the new PATH:
|
|
||||||
```bash
|
|
||||||
source ~/.bashrc
|
|
||||||
```
|
|
||||||
|
|
||||||
### Permission Issues
|
|
||||||
getpkg installs to your home directory and doesn't require root access. If you encounter permission issues, check that `~/.local/bin/` is writable.
|
|
||||||
|
|
||||||
### Network Issues
|
|
||||||
All tools are downloaded from `getpkg.xyz`. Ensure you have internet connectivity and the domain is accessible.
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
### Building getpkg
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build debug version
|
|
||||||
cd getpkg && ./build.sh
|
|
||||||
|
|
||||||
# Run tests
|
|
||||||
cd getpkg && ./test.sh
|
|
||||||
|
|
||||||
# Publish (requires SOS_WRITE_TOKEN)
|
|
||||||
cd getpkg && ./publish.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### Tool Development
|
|
||||||
|
|
||||||
When creating tools for getpkg:
|
|
||||||
|
|
||||||
1. Create a directory with your tool binary
|
|
||||||
2. Optionally include a `setup_script.sh` for post-install setup
|
|
||||||
3. The tool should support `version` and `autocomplete` subcommands
|
|
||||||
4. Use `getpkg publish` to upload to the registry
|
|
||||||
|
|
||||||
For more details, see the development documentation in each tool's directory.
|
|
207
getpkg/README.md
Normal file
207
getpkg/README.md
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
# getpkg - Package Manager for Dropshell Tools
|
||||||
|
|
||||||
|
getpkg is a command-line package manager that simplifies tool installation, management, and publishing for the dropshell ecosystem. Tools are installed to `~/.getpkg/` with executable symlinks in `~/.local/bin/getpkg/` and automatically added to your PATH with bash completion.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install getpkg with a single command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl https://getbin.xyz/getpkg-install | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
After installation, restart your shell or run `source ~/.bashrc` to enable the new PATH and completion settings.
|
||||||
|
|
||||||
|
## Basic Usage
|
||||||
|
|
||||||
|
### Installing Tools
|
||||||
|
|
||||||
|
Install any tool from the getpkg registry:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install a tool
|
||||||
|
getpkg install whatsdirty
|
||||||
|
```
|
||||||
|
|
||||||
|
### Managing Installed Tools
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List all available commands
|
||||||
|
getpkg help
|
||||||
|
|
||||||
|
# Update all installed tools
|
||||||
|
getpkg update
|
||||||
|
|
||||||
|
# Uninstall a tool
|
||||||
|
getpkg uninstall whatsdirty
|
||||||
|
|
||||||
|
# Check getpkg version
|
||||||
|
getpkg version
|
||||||
|
```
|
||||||
|
|
||||||
|
## Available Commands
|
||||||
|
|
||||||
|
### Core Package Management
|
||||||
|
|
||||||
|
- **`getpkg install <tool_name>`** - Install or update a tool
|
||||||
|
- **`getpkg uninstall <tool_name>`** - Remove an installed tool
|
||||||
|
- **`getpkg update`** - Update getpkg and all installed tools
|
||||||
|
|
||||||
|
### Publishing (Requires SOS_WRITE_TOKEN)
|
||||||
|
|
||||||
|
- **`getpkg publish <tool_name[:ARCH]> <folder>`** - Upload a tool to getpkg.xyz
|
||||||
|
- **`getpkg unpublish <tool_name[:ARCH]>`** - Remove a published tool
|
||||||
|
- **`getpkg unpublish <hash>`** - Remove a published tool by hash
|
||||||
|
|
||||||
|
### Development Tools
|
||||||
|
|
||||||
|
- **`getpkg create <tool_name> <directory>`** - Create a new tool project
|
||||||
|
- **`getpkg hash <file_or_directory>`** - Calculate hash of files/directories
|
||||||
|
|
||||||
|
### Information
|
||||||
|
|
||||||
|
- **`getpkg list`** - List all available packages with status
|
||||||
|
- **`getpkg clean`** - Clean up orphaned configs and symlinks
|
||||||
|
- **`getpkg version`** - Show getpkg version
|
||||||
|
- **`getpkg help`** - Show detailed help
|
||||||
|
- **`getpkg autocomplete`** - Show available commands for completion
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
### Installation Process
|
||||||
|
|
||||||
|
When you install a tool, getpkg:
|
||||||
|
|
||||||
|
1. **Downloads** the tool archive from getpkg.xyz
|
||||||
|
2. **Extracts** it to `~/.getpkg/<tool_name>/`
|
||||||
|
3. **Creates symlinks** for all executables in `~/.local/bin/getpkg/`
|
||||||
|
4. **Ensures PATH** includes `~/.local/bin/getpkg` (one-time setup)
|
||||||
|
5. **Enables bash completion** for the tool
|
||||||
|
6. **Runs setup** if a `setup_script.sh` exists
|
||||||
|
7. **Stores metadata** in `~/.config/getpkg/<tool_name>.json`
|
||||||
|
|
||||||
|
### Architecture Support
|
||||||
|
|
||||||
|
getpkg supports multiple architectures:
|
||||||
|
- `x86_64` (Intel/AMD 64-bit)
|
||||||
|
- `aarch64` (ARM 64-bit)
|
||||||
|
- `universal` (cross-platform tools)
|
||||||
|
|
||||||
|
Tools are automatically downloaded for your architecture, with fallback to universal versions.
|
||||||
|
|
||||||
|
### File Locations
|
||||||
|
|
||||||
|
- **Tool files**: `~/.getpkg/<tool_name>/` (actual tool installation)
|
||||||
|
- **Executable symlinks**: `~/.local/bin/getpkg/` (in your PATH)
|
||||||
|
- **Configuration**: `~/.config/getpkg/`
|
||||||
|
- **PATH setup**: `~/.bashrc_getpkg` (sourced by `~/.bashrc`)
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Installing Popular Tools
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install available tools
|
||||||
|
getpkg install dehydrate # File to C++ code generator
|
||||||
|
getpkg install bb64 # Bash base64 encoder/decoder
|
||||||
|
|
||||||
|
# Development tools (for repository development)
|
||||||
|
getpkg install whatsdirty # Check git repo status
|
||||||
|
getpkg install sos # Simple object storage client
|
||||||
|
getpkg install gp # Git push utility
|
||||||
|
```
|
||||||
|
|
||||||
|
### Publishing Your Own Tools
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set your publishing token
|
||||||
|
export SOS_WRITE_TOKEN="your-token-here"
|
||||||
|
|
||||||
|
# Create a new tool project
|
||||||
|
getpkg create mytool ./mytool-project
|
||||||
|
|
||||||
|
# Publish architecture-specific build
|
||||||
|
getpkg publish mytool:x86_64 ./build/
|
||||||
|
|
||||||
|
# Publish universal tool
|
||||||
|
getpkg publish mytool ./build/
|
||||||
|
|
||||||
|
# Remove published tool
|
||||||
|
getpkg unpublish mytool:x86_64
|
||||||
|
```
|
||||||
|
|
||||||
|
### Development Workflow
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create tool structure
|
||||||
|
getpkg create awesome-tool ./awesome-tool
|
||||||
|
cd awesome-tool
|
||||||
|
|
||||||
|
# Build your tool...
|
||||||
|
# Add executable to the directory
|
||||||
|
|
||||||
|
# Test locally
|
||||||
|
./awesome-tool --version
|
||||||
|
|
||||||
|
# Publish when ready
|
||||||
|
getpkg publish awesome-tool:x86_64 .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
- **`SOS_WRITE_TOKEN`** - Authentication token for publishing tools
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Tool Not Found
|
||||||
|
If a tool isn't found after installation, ensure your shell has loaded the new PATH:
|
||||||
|
```bash
|
||||||
|
source ~/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
### Permission Issues
|
||||||
|
getpkg installs to your home directory and doesn't require root access. If you encounter permission issues, check that `~/.local/bin/` is writable.
|
||||||
|
|
||||||
|
### Network Issues
|
||||||
|
All tools are downloaded from `getpkg.xyz`. Ensure you have internet connectivity and the domain is accessible.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Building getpkg
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build debug version
|
||||||
|
cd getpkg && ./build.sh
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
cd getpkg && ./test.sh
|
||||||
|
|
||||||
|
# Publish (requires SOS_WRITE_TOKEN)
|
||||||
|
cd getpkg && ./publish.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tool Development
|
||||||
|
|
||||||
|
When creating tools for getpkg:
|
||||||
|
|
||||||
|
1. Create a directory with your tool binary
|
||||||
|
2. Optionally include a `setup_script.sh` for post-install setup
|
||||||
|
3. The tool should support `version` and `autocomplete` subcommands
|
||||||
|
4. Use `getpkg publish` to upload to the registry
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
The test script creates all temporary files and directories in `test_temp/` to keep the main directory clean:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run tests
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
# Clean up orphaned test files from old test runs (one-time)
|
||||||
|
bash cleanup_old_test_files.sh
|
||||||
|
|
||||||
|
# Clean up orphaned test packages from getpkg.xyz
|
||||||
|
bash cleanup_test_packages.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details, see the development documentation in each tool's directory.
|
98
getpkg/cleanup_test_packages.sh
Executable file
98
getpkg/cleanup_test_packages.sh
Executable file
@ -0,0 +1,98 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Cleanup script for orphaned test packages from getpkg testing
|
||||||
|
# This script removes test packages that start with "test-" from getpkg.xyz
|
||||||
|
# Run from the getpkg directory: bash cleanup_test_packages.sh
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
GETPKG="./output/getpkg"
|
||||||
|
|
||||||
|
# Colors for output
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
echo -e "${YELLOW}Cleaning up orphaned test packages...${NC}"
|
||||||
|
|
||||||
|
# Check if getpkg binary exists
|
||||||
|
if [ ! -f "$GETPKG" ]; then
|
||||||
|
echo -e "${RED}Error: getpkg binary not found at $GETPKG${NC}"
|
||||||
|
echo "Please run ./build.sh first to build getpkg"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if SOS_WRITE_TOKEN is set
|
||||||
|
if [ -z "${SOS_WRITE_TOKEN:-}" ]; then
|
||||||
|
echo -e "${RED}Error: SOS_WRITE_TOKEN environment variable is not set${NC}"
|
||||||
|
echo "This token is required to unpublish packages from getpkg.xyz"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using getpkg binary: $GETPKG"
|
||||||
|
echo "SOS_WRITE_TOKEN is set (${#SOS_WRITE_TOKEN} characters)"
|
||||||
|
|
||||||
|
# Get list of all packages from /dir endpoint
|
||||||
|
echo "Fetching package list from getpkg.xyz/dir..."
|
||||||
|
DIR_RESPONSE=$(curl -s "https://getpkg.xyz/dir" 2>/dev/null || echo "")
|
||||||
|
|
||||||
|
if [ -z "$DIR_RESPONSE" ]; then
|
||||||
|
echo -e "${RED}Failed to fetch package list from server${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract test package labeltags from JSON response
|
||||||
|
# Try with jq first, fallback to grep/sed if jq is not available
|
||||||
|
if command -v jq >/dev/null 2>&1; then
|
||||||
|
TEST_PACKAGES=$(echo "$DIR_RESPONSE" | jq -r '.entries[]?.labeltags[]? // empty' 2>/dev/null | grep "^test-" | sort -u || echo "")
|
||||||
|
else
|
||||||
|
# Fallback: extract labeltags using grep and sed (less reliable but works without jq)
|
||||||
|
TEST_PACKAGES=$(echo "$DIR_RESPONSE" | grep -o '"test-[^"]*"' | sed 's/"//g' | sort -u || echo "")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$TEST_PACKAGES" ]; then
|
||||||
|
echo -e "${GREEN}No test packages found to clean up${NC}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\n${YELLOW}Found test packages to clean up:${NC}"
|
||||||
|
echo "$TEST_PACKAGES" | while read -r package; do
|
||||||
|
echo " - $package"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "\n${YELLOW}Cleaning up test packages...${NC}"
|
||||||
|
|
||||||
|
CLEANED_COUNT=0
|
||||||
|
FAILED_COUNT=0
|
||||||
|
|
||||||
|
# Use process substitution to avoid subshell issues
|
||||||
|
while IFS= read -r package; do
|
||||||
|
if [ -n "$package" ]; then
|
||||||
|
echo -n "Cleaning up $package... "
|
||||||
|
|
||||||
|
# Try to unpublish the package (temporarily disable set -e)
|
||||||
|
set +e
|
||||||
|
$GETPKG unpublish "$package" >/dev/null 2>&1
|
||||||
|
UNPUBLISH_RESULT=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ $UNPUBLISH_RESULT -eq 0 ]; then
|
||||||
|
echo -e "${GREEN}OK${NC}"
|
||||||
|
((CLEANED_COUNT++))
|
||||||
|
else
|
||||||
|
echo -e "${RED}FAILED${NC}"
|
||||||
|
((FAILED_COUNT++))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done <<< "$TEST_PACKAGES"
|
||||||
|
|
||||||
|
echo -e "\n${YELLOW}Cleanup Summary:${NC}"
|
||||||
|
echo "Packages cleaned: $CLEANED_COUNT"
|
||||||
|
echo "Failed cleanups: $FAILED_COUNT"
|
||||||
|
|
||||||
|
if [ $FAILED_COUNT -eq 0 ]; then
|
||||||
|
echo -e "${GREEN}All test packages cleaned up successfully!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Some packages failed to clean up. They may need manual removal.${NC}"
|
||||||
|
fi
|
@ -1 +0,0 @@
|
|||||||
Debug content
|
|
@ -1 +0,0 @@
|
|||||||
test
|
|
@ -1,7 +0,0 @@
|
|||||||
#\!/bin/bash
|
|
||||||
if [ "$1" = "version" ]; then
|
|
||||||
echo "1.0.0"
|
|
||||||
elif [ "$1" = "autocomplete" ]; then
|
|
||||||
echo "help"
|
|
||||||
echo "version"
|
|
||||||
fi
|
|
@ -1,7 +0,0 @@
|
|||||||
#\!/bin/bash
|
|
||||||
if [ "$1" = "version" ]; then
|
|
||||||
echo "1.0.0"
|
|
||||||
elif [ "$1" = "autocomplete" ]; then
|
|
||||||
echo "help"
|
|
||||||
echo "version"
|
|
||||||
fi
|
|
@ -68,6 +68,28 @@ cleanup() {
|
|||||||
# Clean up noarch variant
|
# Clean up noarch variant
|
||||||
$GETPKG unpublish "${TEST_TOOL_NAME}-noarch:universal" 2>/dev/null || true
|
$GETPKG unpublish "${TEST_TOOL_NAME}-noarch:universal" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Clean up any remaining test packages that start with "test-"
|
||||||
|
echo "Cleaning up any remaining test packages..."
|
||||||
|
DIR_RESPONSE=$(curl -s "https://getpkg.xyz/dir" 2>/dev/null || echo "")
|
||||||
|
if [ -n "$DIR_RESPONSE" ]; then
|
||||||
|
# Extract test package labeltags from JSON response
|
||||||
|
if command -v jq >/dev/null 2>&1; then
|
||||||
|
TEST_PACKAGES=$(echo "$DIR_RESPONSE" | jq -r '.entries[]?.labeltags[]? // empty' 2>/dev/null | grep "^test-" | sort -u || echo "")
|
||||||
|
else
|
||||||
|
# Fallback: extract labeltags using grep and sed
|
||||||
|
TEST_PACKAGES=$(echo "$DIR_RESPONSE" | grep -o '"test-[^"]*"' | sed 's/"//g' | sort -u || echo "")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$TEST_PACKAGES" ]; then
|
||||||
|
echo "$TEST_PACKAGES" | while read -r package; do
|
||||||
|
if [ -n "$package" ]; then
|
||||||
|
echo " Cleaning up orphaned test package: $package"
|
||||||
|
$GETPKG unpublish "$package" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Cleaned up test tools from getpkg.xyz"
|
echo "Cleaned up test tools from getpkg.xyz"
|
||||||
else
|
else
|
||||||
echo "Note: SOS_WRITE_TOKEN not set, cannot clean up remote test objects"
|
echo "Note: SOS_WRITE_TOKEN not set, cannot clean up remote test objects"
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#!/bin/bash\necho debug
|
|
@ -1 +0,0 @@
|
|||||||
#!/bin/bash\necho debug2
|
|
@ -1 +0,0 @@
|
|||||||
#!/bin/bash\necho display test
|
|
@ -1 +0,0 @@
|
|||||||
#!/bin/bash\necho multi arch
|
|
@ -1 +0,0 @@
|
|||||||
#!/bin/bash\necho robust test
|
|
@ -1 +0,0 @@
|
|||||||
test content
|
|
72
gp/gp
72
gp/gp
@ -225,19 +225,77 @@ show_status_and_confirm() {
|
|||||||
|
|
||||||
# Show staged changes
|
# Show staged changes
|
||||||
if ! git diff --cached --quiet; then
|
if ! git diff --cached --quiet; then
|
||||||
print_info "Staged changes:"
|
local staged_modified=""
|
||||||
git diff --cached --name-only -- | while IFS= read -r line; do echo " $line"; done
|
local staged_deleted=""
|
||||||
|
local staged_added=""
|
||||||
|
|
||||||
|
# Get staged file status and categorize
|
||||||
|
while IFS=$'\t' read -r status file; do
|
||||||
|
[ -z "$status" ] && continue
|
||||||
|
case "${status:0:1}" in
|
||||||
|
A) staged_added="${staged_added}${file}\n" ;;
|
||||||
|
M) staged_modified="${staged_modified}${file}\n" ;;
|
||||||
|
D) staged_deleted="${staged_deleted}${file}\n" ;;
|
||||||
|
*) staged_modified="${staged_modified}${file}\n" ;; # Default to modified for other statuses
|
||||||
|
esac
|
||||||
|
done < <(git diff --cached --name-status)
|
||||||
|
|
||||||
|
# Show staged added files
|
||||||
|
if [ -n "$staged_added" ]; then
|
||||||
|
print_info "Staged new files:"
|
||||||
|
echo -e "$staged_added" | grep -v '^$' | while IFS= read -r line; do echo " $line"; done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show staged modified files
|
||||||
|
if [ -n "$staged_modified" ]; then
|
||||||
|
print_info "Staged modified files:"
|
||||||
|
echo -e "$staged_modified" | grep -v '^$' | while IFS= read -r line; do echo " $line"; done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show staged deleted files
|
||||||
|
if [ -n "$staged_deleted" ]; then
|
||||||
|
print_info "Staged deleted files:"
|
||||||
|
echo -e "$staged_deleted" | grep -v '^$' | while IFS= read -r line; do echo " $line"; done
|
||||||
|
fi
|
||||||
|
|
||||||
has_staged_changes=true
|
has_staged_changes=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Show unstaged changes
|
# Show unstaged changes
|
||||||
if ! git diff --quiet; then
|
if ! git diff --quiet; then
|
||||||
if [ "$ADD_ALL" = true ]; then
|
local modified_files=""
|
||||||
print_info "Modified files (will be added):"
|
local deleted_files=""
|
||||||
else
|
|
||||||
print_info "Modified files (unstaged, will NOT be included):"
|
# Get file status and categorize
|
||||||
|
while IFS=$'\t' read -r status file; do
|
||||||
|
[ -z "$status" ] && continue
|
||||||
|
case "${status:0:1}" in
|
||||||
|
M) modified_files="${modified_files}${file}\n" ;;
|
||||||
|
D) deleted_files="${deleted_files}${file}\n" ;;
|
||||||
|
*) modified_files="${modified_files}${file}\n" ;; # Default to modified for other statuses
|
||||||
|
esac
|
||||||
|
done < <(git diff --name-status)
|
||||||
|
|
||||||
|
# Show modified files
|
||||||
|
if [ -n "$modified_files" ]; then
|
||||||
|
if [ "$ADD_ALL" = true ]; then
|
||||||
|
print_info "Modified files (will be added):"
|
||||||
|
else
|
||||||
|
print_info "Modified files (unstaged, will NOT be included):"
|
||||||
|
fi
|
||||||
|
echo -e "$modified_files" | grep -v '^$' | while IFS= read -r line; do echo " $line"; done
|
||||||
fi
|
fi
|
||||||
git diff --name-only -- | while IFS= read -r line; do echo " $line"; done
|
|
||||||
|
# Show deleted files
|
||||||
|
if [ -n "$deleted_files" ]; then
|
||||||
|
if [ "$ADD_ALL" = true ]; then
|
||||||
|
print_info "Deleted files (will be removed):"
|
||||||
|
else
|
||||||
|
print_info "Deleted files (unstaged, will NOT be included):"
|
||||||
|
fi
|
||||||
|
echo -e "$deleted_files" | grep -v '^$' | while IFS= read -r line; do echo " $line"; done
|
||||||
|
fi
|
||||||
|
|
||||||
has_unstaged_changes=true
|
has_unstaged_changes=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user