$ wget "https://raw.githubusercontent.com/coderofsalvation/powscript/master/powscript" -O /usr/local/bin/powscript && chmod 755 /usr/local/bin/powscript
$ powscript myscript.pow # run directly
$ powscript --compile myscript.pow > myscript # output bashscript
#!/usr/bin/env powscript
require 'foo'
usage(app)
echo "$app <number>"
switch $1
case [0-9]*
echo "arg 1 is a number"
case *
if empty $1
help=$(usage myapp)
echo "Usage: $help" && exit
Check here for more examples
- indentbased, memorizable, coffeescript-inspired syntax
- more human-like, less semantic noise like { ! [[ @ ]] || ~=
- safetynets: automatic quoting, halt on error
- comfort: easy arrays, easy async, functional programming, named variables instead of positionals
- Modules / bundling
- written in bash 4, 'zero'-dependency solution
- hasslefree: easy installation without gcc compilation/3rd party software
Put this line in your .inputrc
:
"\C-p" "powscript --interactive\n"
Then hitting ctrl-p in your console will enter powscript mode:
hit ctrl-c to exit powscript, type 'edit' to launch editor, and 'help' for help
> each(line)
> echo line=$line
> run()
> tail -2 ~/.kanban.csv | pipemap each
> run
line=1,foo,bar,flop
line=2,foo2,bar2,flop2
>
HINT: use live expansion inside vim. Put the lines below in .vimrc and hit 'p>' in normal/visual mode to expand powscript
vmap p> :!PIPE=2 powscript --compile<CR>
nmap p> ggVG:!PIPE=2 powscript --compile<CR>