Bash Argument Parser Generator
A self-contained web application for interactively building bash argument parsing code. Zero external dependencies - single binary deployment.
Features
- Zero Dependencies: Single Go binary with embedded assets
- Real-time Help Preview: See generated help output as you type
- Clean Separation: Frontend assets organized in separate directories
- Auto-expanding Rows: New input rows appear automatically
- Dark Terminal Theme: Professional terminal-style interface
- Copy to Clipboard: One-click script copying
Architecture
argparse-builder/
├── main.go # Go server with embedded FS
├── static/
│ ├── css/
│ │ └── style.css # Styling
│ └── js/
│ └── app.js # Frontend logic
└── templates/
└── index.html # HTML template
All files are embedded using //go:embed
directive, resulting in a single binary.
Build
go build -o argparse-builder
Run
./argparse-builder
Server starts on port 8080. Open http://localhost:8080 in your browser. Demo available at: https://pages.git.pynezz.dev/argparse-builder
Usage
- Add Custom Header (optional): Set a greeting or description
- Define Arguments:
- Parameters:
-v --verbose
(flag syntax) - Variable Name:
verbose
(internal variable) - Help Text: Description shown in help output
- Parameters:
- Real-time Preview: Help output updates as you type
- Generate: Click "Generate BASH" to create the script
- Copy: Use the copy button to get the generated code
Example Output
For inputs:
- Header: "My Script v1.0"
- Arguments:
-v --verbose
,verbose
, "Enable verbose output"
Generates a complete bash script with:
- Usage function with formatted help
- Argument parsing with case statements
- Variable initialization
- Unknown option handling
-h/--help
support
Technical Details
- Language: Go 1.21+
- Embedding:
embed.FS
for asset bundling - Binary Size: ~9MB (includes runtime and all assets)
- HTTP Server: Standard library net/http
- Frontend: Vanilla JavaScript (no frameworks)
Performance
- Instant startup (no compilation)
- Low memory footprint
- Efficient static file serving from memory
- No external network calls
Security Considerations
- Input sanitization on server side
- No shell execution
- Template-based HTML generation
- CORS headers not set (localhost only by default)
Run in container
File Structure
.
├── assets/
│ ├── Containerfile # OCI production (scratch, ~7MB)
│ └── Containerfile.alpine # Development (Alpine, ~15MB)
│
├── docs/
│ ├── container.md # Primary Podman guide ⭐
│ ├── docker/
│ │ ├── DOCKER_GUIDE.md # Complete Docker reference
│ │ ├── Dockerfile # Docker production
│ │ ├── Dockerfile.alpine # Docker development
│ │ ├── docker-compose.yml
│ │ ├── docker.md # Docker vs Podman
│ │ └── README.md
│ └── README.md # Documentation hub
│
├── Makefile.container # Podman build targets
├── podman-compose.yml # OCI compose with SELinux
├── CONTAINER_QUICKREF.md # One-page reference
├── PODMAN_SUMMARY.md # This summary
└── k8s-deployment.yaml # Kubernetes manifest (TODO)
Usage
# Podman (primary)
podman build -f assets/Containerfile -t argparse-builder .
podman run -d -p 8080:8080 --security-opt label=type:container_t argparse-builder
# Docker (compatibility)
docker build -f assets/Containerfile -t argparse-builder .
docker run -d -p 8080:8080 argparse-builder
Description
Languages
JavaScript
28%
Go
25.9%
CSS
17.9%
HTML
17.7%
Dockerfile
4.5%
Other
6%