sht / short / 🩳

Crate linux osx dicord dicord

A concise cli launcher / project manager using env files.

The main goal it's readability and time saving with commands use in your project. Short it's command-line tool that allow to run program (usually sh script) with environment variables mapping from .env files. - It take care to synchronize and to check the format of all environment files to each other. - Allow multiple setups in the same project. - Allow to store example of no critical environment file in your source code with an public env directory. - Allow to store prod/stage/etc.. and critical environment file in your source code with an private env directory 🔒. - You can apply a mapping in order to select, group and add custom formats / cases on the fly on the environment variables. - The result of mapping will be inject as environment variables in the output .sh script that will be executed.

short global workflow


It's include an index/registry that allow to share project templates: 🌱 template-index.

Install

cargo install short

Configure prompt

✨ PS1 (BASH/ZSH)

Example with PS1 configure by .bashrc

shell script export PS1="$(sht show -f):\w\$ "

Example with PS1 configure by .zshrc

shell script ⚠️ TODO ...

✨ starship

Example with custom pre-prompt : starship.

Here the custom script that starship run before display prompt.

```shell script

!/bin/bash

function blastoff(){ sht show -f } starshipprecmduser_func=blastoff ```

Quick start with template

🌱 Example with Node && ExpressJs

Generate an simply aws sam project base on this template node-express.

Requirement : You have installed node and npm.

$> sht init $> sht generate node-express -d -t $> sht run -t: generate from template. -d: create a sub directory (optional).

🌱 Example with AWS SAM

Generate an simply aws sam project base on this template aws-node-sam.

Requirement : You have installed SAM and AWS_CLI.

$> sht init $> sht generate aws-node-sam -d -t $> sht run -t: generate from template. -d: create a sub directory (optional).

You can list all templates available with sht generate -l and add a new one here.

Quick start blank ✍️

Generate a simply bash script who display variables. You can use this base for do as you want.

$> sht init $> sht generate setup_1 test -d $> sht run -d: create a sub directory (optional).


WIP README - ⚠️ tutorials step by step.

- ⚠️ command documentations.

Commands

init project.

Create an empty short.yaml configuration file. This one define the your project directory. All short command inside of this folder and his child's folders take for references this configuration file. $> sht init short.yaml (generated) yaml setups: {}

generate setup.

Generate an empty setup or a setup from the project templates repository, this command can be also list all available project templates.

✍ Generate an empty setup ️

| Arguments | Required | Description | | ---------- | -------- | ----------- | | | yes | Setup name | | | yes | Env name |

| Options | Allow empty* | Default | Description | | ---------- | -------- | ------- | ----------- | | -d , --directory | yes | | Target directory. | | -p , --private| no | false | 🔒 Save to private directory. [conflict with "-d"] | | -s , --shebang| no | #!/bin/bash | Interpreter program when run.sh generation. | | -f , --file| no | run.sh | Path script, create directory if they miss. [conflict with "-d"] | | -e , --env-directory| no | . | Public env directory. [conflict with "-d"] |

Example : create a setup named my_setup with .test environment file. $> sht generate my_setup test short.yaml (generated) : Configuration file. setups: my_setup: file: run.sh array_vars: all: ".*" vars: [] .test (generated) : Environment file. VAR1=VALUE1 VAR2=VALUE2 run.sh (generated) : Runnable file. ```

!/bin/bash

declare -A all && eval all=($ALL)

declare -p all `` The seconds linedeclare -A all && eval all=($ALL)` allow to use bash associative array.

🌱 List all project templates

$> sht generate -l

🌱 Generate setup from projects template

| Arguments | Required | Description | | ---------- | -------- | ----------- | | | yes | Setup name or \