SkillAgentSearch skills...

Short

A concise cli launcher / project manager using env files 🩳

Install / Use

/learn @vincent-herlemont/Short
About this skill

Quality Score

0/100

Category

Operations

Supported Platforms

Universal

README

sht / short / 🩳

Crate status linux osx azure releases dicord

A concise cli launcher / project manager using env files.

:warning: Deprecated branch, this project will be entirely rewritten.

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 is like to run eval $(.env_file) ./script.sh with more options.

short global workflow

Install

This product is in alpha but for personal use it is reasonably stable.

ArchLinux AUR : short-git

git clone https://aur.archlinux.org/short-git.git
cd short-git
makepkg -si

Homebrew (OSX,Linux)

brew install vincent-herlemont/tap/short

From sources

Require for compilation : libgit2, openssl.

cargo install short

Configure prompt

It's really recommended to configure the prompt. That allow to known every time which setup and
environment are selected. You can see the command show for more details.

<details> <summary>✨ PS1 (BASH/ZSH)</summary>

Example with PS1 configure by .bashrc

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

Example with PS1 configure by .zshrc

⚠️ TODO ...
</details> <details> <summary>✨ starship</summary>

Example with custom pre-prompt : starship.

Here the custom script that starship run before display prompt.

#!/bin/bash

function blastoff(){
    sht show -f
}
starship_precmd_user_func=blastoff

Preview:

$> [my_setup:my_env] ~/your_project$
</details>

Quick start blank ✍️

Generate a simply sh script who display variables. You can use this base for what as you want. See generate for more details.

sht generate <setup_name> <environment_name> <file_kind:sh|bash>
$> sht init
$> sht generate setup_1 test sh -d
$> sht run

-d: create a sub directory (optional).

Quick start with template 🚀

<details> <summary>🌱 Example with <b>Node && ExpressJs</b></summary>

Generate a simply aws sam project base on this template node-express. See generate for more details.

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

</details> <details> <summary>🌱 Example with <b>AWS SAM</b></summary>

Generate a simply aws sam project base on this template aws-node-sam. See generate for more details.

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

</details>

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


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)

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.

<details> <summary><b>✍ Generate an empty setup ️</b></summary>

| Arguments | Required | Description | | ---------- | -------- | ----------- | | <setup_name> | yes | Setup name | | <env_name> | yes | Env name | | <kind> | yes | File kind [sh,bash ...] |

| Options | Allow empty* | Default | Description | | ---------- | -------- | ------- | ----------- | | -d , --directory | yes | <setup_name> | 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

Related Skills

View on GitHub
GitHub Stars7
CategoryOperations
Updated2y ago
Forks0

Languages

Rust

Security Score

75/100

Audited on May 7, 2023

No findings