Skip to content
/ sheesh Public

YAML alias generator 🪂 (w/ flag & completion)

License

Notifications You must be signed in to change notification settings

ariary/sheesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Generate only with: source <(sheesh)


· 🪂 ·

G O !

You have two options:

  • Use sheesh to produce command
  • Define command within a yaml

generate with sheesh

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:
source <(sheesh)

An .sheesh.yml example producing some api call:

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

About

YAML alias generator 🪂 (w/ flag & completion)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published