|
| 1 | + |
| 2 | +# ennbu - .env Editor CLI |
| 3 | + |
| 4 | +`ennbu` is a command-line interface (CLI) tool for managing .env files in your projects, written in Go. It allows you to easily set, replace, list, and get values of keys within your .env files. |
| 5 | + |
| 6 | +## Features |
| 7 | + |
| 8 | +- Get a specific key-value pair from a .env file |
| 9 | +- List all key-value pairs in a .env file |
| 10 | +- Set a new value for a key in a .env file, creating the key if it doesn't exist |
| 11 | +- Replace a value for an existing key in a .env file |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +There are several ways to install ennbu: |
| 16 | + |
| 17 | +1. Using Go |
| 18 | +To install ennbu with Go, make sure you have Go installed on your system, and then run: |
| 19 | + |
| 20 | +```bash |
| 21 | +go install github.com/u-yas/ennbu@latest |
| 22 | +``` |
| 23 | + |
| 24 | +2. Downloading [from GitHub Releases](https://github.com/u-yas/ennbu/releases) |
| 25 | + |
| 26 | +```bash |
| 27 | +curl -L -o ennbu https://github.com/u-yas/ennbu/releases/download/v0.0.1/ennbu-linux-x86_64.tar.gz |
| 28 | +sudo mv ennbu /usr/local/bin/ |
| 29 | +``` |
| 30 | + |
| 31 | +3. Using Docker |
| 32 | + |
| 33 | +```bash |
| 34 | +docker run -it -v "$(pwd):/workdir" ghcr.io/u-yas/ennbu:latest <command> |
| 35 | +``` |
| 36 | + |
| 37 | +4. Github Action |
| 38 | + |
| 39 | +```yml |
| 40 | +--- |
| 41 | +name: "golang testing" |
| 42 | +on: |
| 43 | + pull_request: |
| 44 | + branches: |
| 45 | + - main |
| 46 | +jobs: |
| 47 | + build: |
| 48 | + timeout-minutes: 15 |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v3 |
| 52 | + - uses: actions/setup-go@v4 |
| 53 | + with: |
| 54 | + go-version-file: "./go.mod" |
| 55 | + - name: go mod download |
| 56 | + run: go mod download |
| 57 | + - name: replace APP_ENV |
| 58 | + |
| 59 | + with: |
| 60 | + envPath: .env |
| 61 | + commands: | |
| 62 | + set -k APP_ENV test |
| 63 | + list --json |
| 64 | + - name: go test |
| 65 | + run: go test ./... |
| 66 | + |
| 67 | +``` |
| 68 | + |
| 69 | +### Usage |
| 70 | + |
| 71 | +#### Get |
| 72 | + |
| 73 | +To get the value of a specific key in a .env file, use the `get` command: |
| 74 | + |
| 75 | +```bash |
| 76 | +ennbu get -k KEY_NAME -e .env |
| 77 | +``` |
| 78 | + |
| 79 | +#### List |
| 80 | + |
| 81 | +To list all key-value pairs in a .env file, use the `list` command: |
| 82 | + |
| 83 | +```bash |
| 84 | +ennbu list -e .env |
| 85 | +``` |
| 86 | + |
| 87 | +To list the key-value pairs in JSON format, use the `--json` flag: |
| 88 | + |
| 89 | +```bash |
| 90 | +ennbu list --json -e .env |
| 91 | +``` |
| 92 | + |
| 93 | +#### Set |
| 94 | + |
| 95 | +To set a new value for a key in a .env file, use the `set` command: |
| 96 | + |
| 97 | +```bash |
| 98 | +ennbu set -k KEY_NAME -v VALUE -e .env |
| 99 | +``` |
| 100 | + |
| 101 | +#### Replace |
| 102 | + |
| 103 | +To replace a value for an existing key in a .env file, use the `replace` command: |
| 104 | + |
| 105 | +echo NEW_VALUE | ennbu replace -k KEY_NAME -e .env |
| 106 | + |
| 107 | +## Contributing |
| 108 | + |
| 109 | +Contributions are welcome! Please feel free to submit a [pull request](https://github.com/u-yas/ennbu/pulls) or [open an issue.](https://github.com/u-yas/ennbu/issues/new) |
0 commit comments