View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
chocolateboy > App-Wax > wax


Annotate this POD

View/Report Bugs


wax - webify your CLI


    wax [OPTIONS] program [OPTIONS] ...


    $ wax vim -R


    $ vim -R /tmp/wax_abcd1234.tgz


wax is a command-line program which runs other command-line programs and converts their URL arguments to local file paths. By default, the files are removed after the command has exited.

As well as adding transparent support for remote resources to commands that don't support them natively, wax can be used to:


The following wax options can be supplied before the command name. Subsequent options are passed to the command verbatim, apart from URLs, which are converted to paths to the corresponding files. URL arguments can be excluded from the conversion process by supplying a separator token (default --). Arguments after this are no longer processed by wax and are passed through verbatim e.g.:

    $ wax --cache cmd -- --referrer

Note that the --cache and --mirror options are mutually exclusive i.e. only one (or neither) should be supplied. Supplying both will cause wax to terminate with an error.

Note that option bundling is not currently supported e.g. reach --cache --verbose ... can't be condensed to reach -cv ..., and would need to be written as reach -c -v ....

-c, --cache

Don't remove the downloaded file(s) after the command exits. Subsequent invocations will resolve the URL(s) to the cached files(s) (if still available) rather than hitting the network.

If a local file no longer exists, the resource is re-downloaded.

Note: by default, files are saved to the system's temp directory, which is typically cleared when the system restarts. To save files to another directory, use the -D or --directory option.

-d, --dir, --directory STRING

Specify the directory to download files to. Default: the system's temp directory.

If the directory doesn't exist, it is created if its parent directory exists. Otherwise, an error is raised.


Download files to $XDG_CACHE_HOME/wax or $HOME/.cache/wax rather than the system's temp directory. Can be overriden by -d.

If the directory doesn't exist, it is created if its parent directory exists. Otherwise, an error is raised.

-h, -?, --help

Display this documentation.

-m, --mirror

Like the --cache option, this keeps the downloaded file(s) after the command exits. In addition, a HEAD request is issued for each resource to see if it has been updated. If so, the latest version is downloaded; otherwise, the cached version is used (if still available).

If a local file no longer exists, the resource is re-downloaded.

-s, --separator STRING

Override the default separator-token (--) used to mark the end of waxable options e.g.:

    $ wax --cache --separator :: cmd :: --referrer

Note: the separator token is removed from the list of options passed to the command.

-S, --no-separator

Disable separator-token handling i.e. leave the default separator (--) to be handled by the command.

-t, --timeout INTEGER

Set the timeout for network requests in seconds. Default: 60.

-u, --user-agent STRING

Set the user-agent string for network requests.

-v, --verbose

Print diagnostic information to STDERR.

-V, --version

Print the version of wax.



    $ alias espeak="wax espeak"
    $ espeak -f


    $ wax grep -B1 demons


Browse files in Node module tarballs


    # usage: jsview <module> e.g. jsview left-pad
    wax --cache view $(npm info --json "$@" | jq -r .dist.tarball)


Node.js man-page viewer


    node_version=${NODE_VERSION:-`node --version`}
    wax --cache -D pandoc --standalone --from markdown --to man "$docroot/$" | man -l -


As with any command-line programs that take URL parameters, care should be taken to ensure that special shell characters are suitably quoted. As a general rule, URLs that contain &, ~, <, >, $ &c. should be quoted in shells on Unix-like systems and quoted with embedded escapes in Windows cmd/command.exe-like shells.

It's worth checking that a program actually needs waxing. Many command-line programs already support URLs e.g:

    $ eog
    $ gedit
    $ gimp
    $ perldoc -F "'s_guide.pod"
    $ vim






chocolateboy <>


Copyright (c) 2010-2018 by chocolateboy.

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.

syntax highlighting: