A local script management tool for quick execution of JavaScript and Shell scripts with advanced alias support.
中文文档 | English
- 🚀 Quick Execution: Run local scripts with simple
q script-name
command - 📁 Multiple Formats: Support JavaScript (.js), Shell scripts (.sh), and directories
- 🔗 Advanced Aliases: Configure custom aliases with relative paths, absolute paths, and system commands
- 📝 Parameter Forwarding: Pass arguments transparently to your scripts
- 🎯 Smart Priority: Alias config > Script files > System commands
- ⚡ Global Access: Install once, use anywhere
- 🧪 Comprehensive Testing: 16 automated test cases ensure reliability
npm install -g quick-sh
After installation, you can use the q
command globally.
# Set your script directory
q -path /path/to/your/scripts
# Check current status
q -list
# Run a JavaScript file
q myscript
# Run a shell script
q deploy.sh
# Run with parameters
q backup --target /data --compress
# Execute directory (looks for index.js or index.sh)
q myproject
Create or edit config.json
in your script directory:
{
"aliases": {
"deploy": {
"bin": "./deploy/index.js"
},
"backup": {
"bin": "/usr/local/bin/backup.sh"
},
"start": {
"bin": "npm start"
}
}
}
Command | Description | Example |
---|---|---|
q -path <dir> |
Set script directory | q -path ~/scripts |
q -list |
Show current status and available scripts | q -list |
q -help |
Display help information | q -help |
q <script> |
Execute script or alias | q deploy |
-
Relative Path: Relative to script directory
{ "aliases": { "deploy": {"bin": "./deploy/index.js"} } }
-
Absolute Path: Full system path
{ "aliases": { "backup": {"bin": "/usr/local/bin/backup.sh"} } }
-
System Command: Execute system commands
{ "aliases": { "list": {"bin": "ls -la"}, "findnode": {"bin": "which node"} } }
- Alias Configuration (highest priority)
- Script Files (medium priority)
- System Commands (lowest priority)
All parameters are transparently forwarded to target scripts:
# These parameters will be passed to the script
q deploy --env production --verbose
q backup /data/important --compress
In your script, access parameters normally:
- JavaScript:
process.argv
- Shell:
$1
,$2
, etc.
~/scripts/
├── config.json
├── deploy.js
├── backup.sh
└── utils/
└── index.js
{
"aliases": {
"deploy": {"bin": "./deploy.js"},
"util": {"bin": "./utils"},
"backup": {"bin": "./backup.sh"},
"start": {"bin": "npm start"}
}
}
# Execute via alias
q deploy --env prod
# Execute shell script
q backup.sh /data
# Execute directory (looks for utils/index.js)
q utils --help
# System command via alias
q start
# Run all tests
npm test
# Manual testing with example scripts
npm run test:manual
quick-sh/
├── bin/ # CLI entry point
├── lib/ # Core modules
│ ├── config.js # Configuration management
│ ├── executor.js # Script execution
│ ├── help.js # Help text
│ ├── script-manager.js # Main logic
│ └── utils.js # Utilities
├── test/ # Test suite
└── examples/ # Example scripts
- Node.js >= 14.0.0
- npm or yarn
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Young6118 - Initial work
If you encounter any issues or have questions, please open an issue on GitHub.