poly
Search…
Clojure CLI Tool
Exec Arguments vs Polylith Tool Documentation
The poly uses its own syntax when passing in parameters. When using the poly command as a Clojure CLI Tool (see Install using Clojure CLI) we instead use the standard way of passing in arguments as pairs.
The "native" poly tool has the following argument structure:
  • the command, followed by
  • zero or more entities (e.g., create can be followed by component), followed by
  • named arguments (e.g., project:example), and
  • flag arguments (e.g., :loc), and
  • profiles (e.g., +remote).
Because "exec args" must follow key/value syntax, the argument structure for -Tpoly is:
  • the command (which is the "exec fn"), followed by
  • entity to name the first argument(s) to create or help,
  • named arguments as key/value pairs (e.g., project example),
  • flag arguments as keys with true or false values (e.g., loc true),
  • profiles to list any profiles to enable, without the leading + (e.g., profiles '[remote]').
For convenience, most arguments can be provided as symbols rather than requiring quoted strings:
1
# strings have to be quoted for EDN and the shell:
2
clojure -Tpoly info project '"example"'
3
# the following shorthand is allowed:
4
clojure -Tpoly info project example
Copied!
Both project and profile exist in singular form, taking a symbol or string, and in a plural form, taking a vector of symbols or strings:
1
# select more than one project:
2
clojure -Tpoly info projects '[example cli]'
3
# select just one profile:
4
clojure -Tpoly info profile remote
Copied!
Some poly commands treat :brick and :project as flag arguments and other expect brick:name or project:name as named arguments. When using "exec args", the meaning is determined by whether the value is boolean or not:
1
# select all projects:
2
clojure -Tpoly info project true # flag argument
3
# select a specific project:
4
clojure -Tpoly info project cli # named argument
Copied!
Since the exec argument format for create becomes verbose, there are four shortcut arguments:
1
# full create command syntax:
2
clojure -Tpoly create entity '"component"' name user
3
# shorthand:
4
clojure -Tpoly create c user
5
# similarly for b (base), p (project), and w (workspace)
6
clojure -Tpoly create w next-gen top-ns com.my-company
7
# is shorthand for:
8
clojure -Tpoly create entity '"workspace"' name next-gen top-ns com.my-company
Copied!
Finally, for some commands, more than one "entity" can be provided for the entity exec argument, those can be :-separated (in a string), or use entities and a vector (which can have symbols instead of strings):
1
clojure -Tpoly help entity '"create:component"'
2
# equivalent to:
3
clojure -Tpoly help entities '[create component]'
Copied!
While the entity argument must be a quoted string today, a future version of the poly tool will allow symbols to be used so the quotes can be omitted.
Last modified 1mo ago
Copy link