bashme
Stop wasting time writing "boilerplate" code in Bash. Describe your installation scenario in YAML,
bashmegenerates a robust, interactive, and stylized Shell script.
⚡ Why bashme?
Writing installation or maintenance scripts (install.sh, setup.sh) is often painful:
* Managing colors and cursors (UI) is complex.
* Error handling (set -e vs if [ $? ... ]) is verbose.
* Asking for user inputs securely is repetitive.
*bashme solves this: you write a simple recipe in YAML, and it compiles a standalone Bash script*.
✨ Features
- *Zero Dependencies:* The generated
.shscript runs everywhere (Ubuntu, Debian, CentOS, macOS...). The end user does NOT needbashmenorpython/ansible. - *Modern UI:* Colors, loading spinners, and automatic formatting included.
- *Interactivity:* Easy input management (text, masked passwords).
- *Conditional Logic:*
if/elseconditions, software checks, and error handling (fallback). - *Templating:* Reuse entered variables in subsequent commands.
🚀 Demo
Demonstration yaml instructions
destinationFile: "install.sh"
bashHeader: "#!/bin/bash"
requireSudo: false
instructions:
- step:
name: "Ask for a username"
input:
type: "text"
prompt: "Please enter your desired username"
variable: "USERNAME"
- step:
name: "Ask for a password"
input:
type: "password"
prompt: "Please enter your desired password"
variable: "PASSWORD"
- step:
name: "Display credentials"
action:
type: "message"
message: "User: {{USERNAME}}, Password: {{PASSWORD}}"
📦 Installation
Via Go (Recommended for devs)
go install github.com/nduboi/bashme@latest
Via Binaries (Linux/Mac/Windows)
Go to the Releases page to download the latest version.
🛠️ Quick Usage
Create a setup.yaml file:
destinationFile: "install.sh"
requireSudo: false
instructions:
- step:
name: "Configuration"
input:
type: "text"
prompt: "What is your project name?"
variable: "PROJECT_NAME"
- step:
name: "Preparation"
action:
type: "command"
message: "Creating folder for {{ PROJECT_NAME }}"
command: "mkdir -p .{{ PROJECT_NAME }}"
when: "! -d ./{{ PROJECT_NAME }}" # Only executes if folder doesn't exist
- step:
name: "End"
action:
type: "message"
message: "Great! Project {{ PROJECT_NAME }} is ready."
Generate the script:
bashme setup.yaml
Run the generated script:
chmod +x install.sh
./install.sh
📚 Documentation
Complete documentation (Detailed YAML syntax, advanced examples, conditions) is available here:
🤝 Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests to us.
- Fork the project on GitHub.
- Clone your fork locally.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Make your changes. You can run tests using
go test ./.... - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Reporting Issues
If you find a bug or have a feature request, please open an issue on the GitHub Issue Tracker.
📄 License
Distributed under the MIT License. See LICENSE for more information.