Skip to content

bashme

GitHub go.mod Go version GitHub license Go Report Card

Stop wasting time writing "boilerplate" code in Bash. Describe your installation scenario in YAML, bashme generates 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 .sh script runs everywhere (Ubuntu, Debian, CentOS, macOS...). The end user does NOT need bashme nor python/ansible.
  • *Modern UI:* Colors, loading spinners, and automatic formatting included.
  • *Interactivity:* Easy input management (text, masked passwords).
  • *Conditional Logic:* if/else conditions, software checks, and error handling (fallback).
  • *Templating:* Reuse entered variables in subsequent commands.

🚀 Demo

Image

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

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:

👉 docs.nduboi.fr/bashme


🤝 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.

  1. Fork the project on GitHub.
  2. Clone your fork locally.
  3. Create your feature branch (git checkout -b feature/AmazingFeature).
  4. Make your changes. You can run tests using go test ./....
  5. Commit your changes (git commit -m 'Add some AmazingFeature').
  6. Push to the branch (git push origin feature/AmazingFeature).
  7. 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.