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 like like to run eval $(.env_file) ./script.sh with more options. - It take care to synchronize and to check the format of all environment files to each other. - Prompt infos : You always know that is your current project and environment. - Allow multiple setups in the same project. - Allow to store example of no critical environment file in your source code with a public env directory. - Allow to store prod/stage/etc.. and critical environment file in your source code with a 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

Require for compilation : libgit2, openssl. 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 ```

Preview: $> [my_setup:my_env] ~/your_project$

Quick start with template

🌱 Example with Node && ExpressJs

Generate a 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 a 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 sh script who display variables. You can use this base for what as you want.

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


WIP README - ⚠️ tutorials step by step.

- ⚠️ commands documentation.

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 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 a 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 | | \ | yes | File kind [sh,bash ...] |

| Options | Allow empty* | Default | Description | | ---------- | -------- | ------- | ----------- | | -d , --directory | yes | | Target directory. | | -p , --private| no | false | 🔒 Save to private directory. [conflict with "-d"] | | -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 and bash script. $> sht generate my_setup test bash short.yaml (generated) : Configuration file. setups: my_setup: file: run.sh array_vars: all: pattern: ".*" case: CamelCase format: "[{key}]='{value}'" delimiter: " " 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 \