sheesh

command module
v0.0.0-...-7c8dd5d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2023 License: Unlicense Imports: 2 Imported by: 0

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

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)

Documentation ¶

The Go Gopher

There is no documentation for this package.

Directories ¶

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL