npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

powscript

v1.1.2

Published

bash dialect transpiler in bash: painless shellscript / indentbased / coffeescript for shellscript / bash for hipsters

Downloads

4

Readme

Travis build status

write shellscript in a powful way!

IMPORTANT: a brand NEW powscript beta-version is available here, come see!

Usage

$ 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 -c myscript.pow > myscript            # output bashscript
$ powscript -c --to sh myscript.pow > myscript.sh # output sh-script (experimental)

Wiki

Example

#!/usr/bin/env powscript
require_cmd 'echo'
require_env 'TERM'

error(msg exitcode)
  echo "error: $msg"
  if set? $exitcode
    exit $exitcode

run(@args -- foo)
  if empty? foo
    error "please pass --foo <string>" 1
  echo $args[@] "$foo universe!!"
  echo "HOME=$HOME"

run $@

Output:

$ powscript -c foo.pow -o foo.bash
$ ./foo.bash hello --foo powful
hello powful universe!
HOME=/home/yourusername

Check a json example here and here for more examples

Features

Examples

Interactive mode (experimental)

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 | mappipe each
> run
line=1,foo,bar,flop
line=2,foo2,bar2,flop2
>

POSIX /bin/sh compatibility

Powscript can produce 'kindof' POSIX /bin/sh-compatible output by removing bashisms, by introducing the --sh flag:

$ powscript --compile foo.pow      > foo.bash
$ powscript --sh --compile foo.pow > foo.sh

This however, is experimental, as well as the standalone bash2sh converter:

$ cat foo.bash | powscript --tosh  > foo.sh

NOTE: remove bashisms manually using docs/tools like bashism guide or checkbashisms The general rule for POSIX sh-output is: don't write bashfeatures in powscript

Debug your powscript syntax

See FAQ

Live expansion inside editor

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>

OSX users

OSX might protest since it isn't quite GNU focused. Please run these commands after installing:

$ brew install bash
$ brew install coreutils gnu-sed grep gawk --default-names
$ echo 'export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH' >> ~/.bashrc
$ sed -i 's|#!/bin/bash|#!/usr/local/bin/bash|g' powscript