Transform your shell scripts into powerful CLI tools with autocomplete, help messages, and argument validation
Project description
version = "2.0.2"
RunSH
Transform your shell scripts into powerful CLI tools with autocomplete, help messages, and argument validation.
✨ Features
- 🔧 Zero Configuration: Add simple comments to your scripts
- 🌍 GitHub Integration: Run scripts directly from GitHub repositories
- 💾 Smart Caching: Offline support with automatic cache management
- 🎯 Auto-completion: Rich CLI experience with argument validation
- 📁 Organized: All files managed in
.runsh/directory
🚀 Quick Start
Installation
pip install runsh
Basic Usage
- Create a script with metadata comments:
#!/bin/bash
# @description: Deploy application to production
# @arg environment: Target environment (staging/prod)
# @option verbose,v [flag]: Show detailed output
# @option dry-run,d [flag]: Preview changes without executing
echo "Deploying to $ENVIRONMENT..."
[ "$VERBOSE" = "1" ] && echo "Verbose mode enabled"
- Run with RunSH:
# Auto-discovers scripts in ./scripts/
runsh deploy production --verbose
# Get help automatically
runsh deploy --help
GitHub Integration
# Initialize configuration
runsh config init
# Edit .runsh/config.yaml
scripts_dir: "https://github.com/user/repo/tree/main/scripts"
# Use scripts from GitHub
runsh list
runsh deploy --help
📖 Documentation
- Getting Started - Detailed setup and first script
- Script Syntax - Complete metadata reference
- Configuration - Settings and customization
- GitHub Integration - Remote script management
- Cache Management - Offline usage and performance
- Examples - Real-world script examples
🎯 Key Commands
# Script Management
runsh list # List available scripts
runsh <script-name> --help # Get script help
# Configuration
runsh config show # Show current config
runsh config init # Create config file
# Cache Management
runsh cache list # List cached scripts
runsh cache clean # Clean expired cache
runsh cache clean --all # Clean all cache
📁 Project Structure
.runsh/
├── config.yaml # Main configuration
└── cache/ # GitHub script cache
└── github_user_repo_main_scripts/
├── script1.sh
└── .metadata
🔧 Script Metadata
Add these comments to your shell scripts:
# @description: Brief description of what the script does
# @arg name [optional] [default=value]: Argument description
# @option name,short [flag]: Option description
# @option timeout [default=30]: Value option with default
🌍 Remote Scripts
# .runsh/config.yaml
scripts_dir: "https://github.com/team/devops-scripts/tree/main/tools"
default_shell: "bash"
📚 Examples
Python Package Publishing
#!/bin/bash
# @description: Publish Python package to PyPI
# @option test,t [flag]: Upload to TestPyPI instead
# @option skip-build,s [flag]: Skip building step
# Build and publish logic here...
runsh publish-python --test # Test on TestPyPI first
runsh publish-python # Publish to PyPI
🛠️ Configuration
Environment Variables
export RUNSH_SCRIPTS_DIR="~/my-scripts"
export RUNSH_SHELL="zsh"
Config File
# .runsh/config.yaml
scripts_dir: "./tools" # Local directory
# scripts_dir: "https://github.com/user/repo/tree/main/scripts" # GitHub
default_shell: "bash"
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Links
- Documentation: docs/
- Issues: GitHub Issues
- PyPI: https://pypi.org/project/runsh/
Transform your shell scripts into professional CLI tools! 🚀
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file runsh-2.0.2.tar.gz.
File metadata
- Download URL: runsh-2.0.2.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bfe680d3c9ea6b0605f0f8a4ae671d86f7e9353170e2bd2b99167e54cf769b2
|
|
| MD5 |
4f311462984fe406d1ccac36a15f6c8e
|
|
| BLAKE2b-256 |
cee6dba06bfebdf4ebc5cd35edecb853bcb28d53f4eb3c5cf6ee4facc1e2c420
|
File details
Details for the file runsh-2.0.2-py3-none-any.whl.
File metadata
- Download URL: runsh-2.0.2-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fd115ba1b84b7fe2e745aaff2e934f16d798972661ef307b8833445e2a1d986
|
|
| MD5 |
0dab7d91d371562a8d0b181333cd8cb8
|
|
| BLAKE2b-256 |
568abbef8d67aeab8c83a6e675e9fc6a614672a6117fc0ecf8a0ceb45dd8b32d
|