| layout | page |
|---|---|
| title | Home |
| permalink | / |
Transform any shell script into a fully-featured command-line tool with zero effort.
Argorator automatically converts your shell scripts' variables and positional arguments into a proper CLI interface with --help, argument validation, and type conversion - all without modifying your original script.
pip install argoratorOr with pipx (recommended for global installation):
pipx install argoratorTake any shell script with variables:
# deploy.sh
#!/bin/bash
echo "Deploying $SERVICE to $ENVIRONMENT"
echo "Version: $VERSION"Run it with Argorator:
$ argorator deploy.sh --help
usage: argorator deploy.sh [-h] --service SERVICE --environment ENVIRONMENT --version VERSION
optional arguments:
-h, --help show this help message and exit
--service SERVICE
--environment ENVIRONMENT
--version VERSION
$ argorator deploy.sh --service api --environment prod --version v1.2.3
Deploying api to prod
Version: v1.2.3That's it! No modifications needed to your script.
Make your scripts directly executable:
#!/usr/bin/env argorator
# deploy-service.sh
echo "🚀 Deploying $SERVICE_NAME to $ENVIRONMENT"
echo "📦 Version: ${VERSION:-latest}"
if [ "$DRY_RUN" = "true" ]; then
echo "🔍 DRY RUN - No changes will be made"
fi
echo "✅ Deployment complete!"$ chmod +x deploy-service.sh
$ ./deploy-service.sh --help
usage: deploy-service.sh [-h] --service_name SERVICE_NAME --environment ENVIRONMENT [--version VERSION] [--dry_run DRY_RUN]
options:
-h, --help show this help message and exit
--service_name SERVICE_NAME
--environment ENVIRONMENT
--version VERSION (default from env: latest)
--dry_run DRY_RUN
$ ./deploy-service.sh --service-name api --environment staging --dry-run true
🚀 Deploying api to staging
📦 Version: latest
🔍 DRY RUN - No changes will be made
✅ Deployment complete!Undefined variables in your script become required CLI arguments:
# greet.sh
echo "Hello, $NAME!"
echo "You are $AGE years old"$ argorator greet.sh --name Alice --age 30
Hello, Alice!
You are 30 years oldVariables that exist in your environment become optional arguments with defaults:
# show-env.sh
echo "Home: $HOME"
echo "User: $USER"
echo "Custom: $CUSTOM_VAR"$ argorator show-env.sh --help
usage: argorator show-env.sh [-h] --custom_var CUSTOM_VAR [--home HOME] [--user USER]
options:
-h, --help show this help message and exit
--custom_var CUSTOM_VAR
--home HOME (default from env: /home/yourusername)
--user USER (default from env: yourusername)
$ argorator show-env.sh --custom-var "test"
Home: /home/yourusername
User: yourusername
Custom: testScripts using $1, $2, etc. automatically accept positional arguments:
# backup.sh
#!/bin/bash
echo "Backing up $1 to $2"
echo "Compression: ${COMPRESSION:-gzip}"$ argorator backup.sh --help
usage: argorator backup.sh [-h] [--compression COMPRESSION] ARG1 ARG2
positional arguments:
ARG1
ARG2
options:
-h, --help show this help message and exit
--compression COMPRESSION
(default from env: gzip)
$ argorator backup.sh /data /backups --compression bzip2
Backing up /data to /backups
Compression: bzip2Collect multiple arguments using $@ or $*:
# process-files.sh
#!/bin/bash
echo "Processing files:"
for file in "$@"; do
echo " - $file"
done$ argorator process-files.sh doc1.txt doc2.txt doc3.txt
Processing files:
- doc1.txt
- doc2.txt
- doc3.txt- Documentation Home - Full documentation index
- Google-Style Annotations - Type annotations and help text (v0.3.0+)
- Changelog - Version history and release notes
Generate a standalone script with variables pre-filled:
$ argorator compile script.sh --var value > compiled.shGenerate shell export statements:
$ eval "$(argorator export script.sh --var value)"- Script Analysis: Argorator parses your shell script to identify variables and positional arguments
- CLI Generation: Creates an argparse interface with appropriate options
- Script Execution: Injects variable definitions and runs your script
- Python 3.9+
- Unix-like operating system (Linux, macOS, WSL)
- Bash or compatible shell
- 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
This project is licensed under the MIT License - see the LICENSE file for details.