Liking cljdoc? Tell your friends :D

Polyx

The polyx tool is the same as poly with one extra trick: it can output images for some commands.

The features and interface of this tool are subject to change. A future release may expose its functionality in some different way.

We created the polyx tool separate from poly because:

  1. There have been reports of issues with Apple Silicon when using Java AWT used by the underlying Clojure2d library used by polyx to output images.

  2. Java AWT starts a Java process:

    java

    which is not ideal for a command line tool.

Install via :polyx alias

Unlike poly, we have no AOT-compiled polyx jar for you to download. If you want to use polyx, add it as an alias to your ./deps.edn file:

:polyx {:main-opts ["-m" "polylith.clj.core.poly-cli.core"]
        :extra-deps {polyfy/polylith
                     {:git/url   "https://github.com/polyfy/polylith"
                      :sha       "9e79264981b0c5be6e6cb70c93a540a82c489510" (1)
                      :deps/root "projects/polyx"}}}}}
1Choose the revision via a Git SHA

Finding your Git SHA

Stable

For the sha of the latest stable release, navigate to https://github.com/polyfy/polylith/releases/latest (versions will differ from images below, but the page layout should be the same):

  1. click on the tag:
    github click tag

  2. click on commits:
    github click commits

  3. and finally copy the full sha:
    github copy full sha

SNAPSHOT

For the latest SNAPSHOT release, navigate to https://github.com/polyfy/polylith:

  1. click on commits (as above)

  2. and copy the full sha (as above)

From Command Line

Or, if you prefer the command line, this should give you the data you need:

git ls-remote --tags --refs --sort=-version:refname \
    https://github.com/polyfy/polylith.git

Using

Start a shell from the example workspace root dir:

clojure -M:polyx

The polyx tool can create output images for info, deps, libs, and overview commands. Let’s create an output image from info:

example$ info out:info.png
info

If you need a transparent background, which can be useful if you are going to use the image graphically, e.g. on a website or to print a T-shirt, you can pass in :transparent:

example$ deps out:deps.png :transparent

Set the color mode to light if you want a white background:

example$ info color-mode:light out:info.png
info light

Most people typically create .png images, but you can choose any image format Clojure2d supports.

If you choose any other filename extension, e.g., .txt, polyx will output text:

example$ poly info out:info.txt

The output contains ANSI escape codes to colorize the text. If you cat info.txt you’ll see colorful output:

info

ANSI escape codes are not appropriate for some usages. Specify color-mode:none for plaintext output:

example$ info out:info.txt color-mode:none
  stable since: c91fdad

  projects: 2   interfaces: 1
  bases:    1   components: 1

  project         alias  status   dev
  -----------------------------   ---
  command-line *  cl      ---     ---
  development *   dev     s--     s--

  interface  brick    cl    dev
  -----------------   ---   ---
  user       user *   stx   st-
  -          cli *    stx   st-

The overview Command

The polyx tool includes an overview command:

example$ overview out:overview.png :no-changes

Generates:

overview

For some real world examples of overview images see Example Systems and Production Systems.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close