https://github.com/ariary/sheesh
YAML alias generator ๐ช (w/ flag & completion)
https://github.com/ariary/sheesh
alias hack shell
Last synced: about 1 month ago
JSON representation
YAML alias generator ๐ช (w/ flag & completion)
- Host: GitHub
- URL: https://github.com/ariary/sheesh
- Owner: ariary
- License: unlicense
- Created: 2023-01-25T17:45:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-24T15:20:00.000Z (about 3 years ago)
- Last Synced: 2025-02-26T05:42:24.052Z (over 1 year ago)
- Topics: alias, hack, shell
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Generate only with:
source <(sheesh)
ยท ๐ช ยท
## G O !
You have two options:
* Use `sheesh` to produce command
* Define command within a yaml
### generate with `sheesh`
```shell
sheesh setcommand --command "hello" --script "echo 'hello'"
sheesh setflag --command "hello" --name "who" --predefined "toto,titi,tata"
sheesh setflag --command "hello" --name "nrandom" --noargs
sheesh setscript --command "hello" --script "if [ \"\$RANDOM\" = true ]; then WHO='toto';fi;echo \"hello \${WHO}\""
source <(sheesh)
```
### generate with yaml file
1. Create `.sheesh.yml` file
2. Launch:
```shell
source <(sheesh)
```
An `.sheesh.yml` example producing some api call:
```yaml
---
commands:
- name: api-postman
flags:
- name: stealth
description: "change User-Agent"
noarg: true
- name: token
predefined:
- "THISISAADMINTOKEN"
- "Dzdk7e0987djjdzz87dz"
- name: save
description: "file to save output"
file: true
script: |
USERAGENT="curl 2.0/7"
if [ "$STEALTH" = true ] ; then
USERAGENT="not a hacker"
fi
if [ -n "$SAVE" ];then
curl -H "User-Agent: ${USERAGENT}" -H "Authorization: Bearer ${TOKEN}" http://postman-echo.com/get > "${SAVE}"
else
curl -H "User-Agent: ${USERAGENT}" -H "Authorization: Bearer ${TOKEN}" http://postman-echo.com/get
fi
```
## T I P S ๐ฉ
* very useful when you are testing api with `curl`
* want to have command in all shell, add this to `.${SHELL}rc`: `source <(sheesh --file [PATH_TO_SHEESHYAML]`)
## Limits/Improvement
* Only for zsh
* Use uppercase flag name in your script to use it value (`$FLAGNAME`)
* No default value
* Can't use var with "-" (hence flag too)