Pnyx CMD comes in 2 formats: YAML and C# scripts. When Pnyx is ported to other platforms / languages, then those will be available from the CMD. Plans are for Python, Java, Javascript, and others. The YAML format is language independent and will be supported on all platforms.
pnxy
executable.pncs
executable.pnyx
reads a YAML array of commands and executes them. By default, pnyx
reads the commands
from a YAML file. pnyx
parses YAML content and expects an array of mappings. Each mapping represents a method
on the Pnyx fluent library. See the Library documentation for a full list of methods available.
YAML is a very flexible format, but has a steep learning curve compared to other formats (like JSON). It is recommended
to learn the basics well before writing Pnyx files (good YAMLTutorial).
pnyx my.yaml.pnyx
- readString: ax,bx,cx,dx - sed: ['x','y','ig'] - parseCsv: - print: $4|$3|$2|$1
dy|cy|by|ay
pnyx
with the inline flag (-i, --inline
) to embed
YAML as a parameter. The previous example could be written as:
pnyx -i "[{readString: 'ax,bx,cx,dx'},{sed: ['x','y','ig']},{parseCsv: },{print: $4|$3|$2|$1}]"
pncs
reads a C# script and executes it. By default, pncs
reads the C# scripts from
a file. pncs
uses the Roslyn
compiler with a Pnyx object set as the global object, which allows method calls directly from the
fluent library. pnyx my.cs.pncs
readString("ax,bx,cx,dx"); sed("x","y","ig"); parseCsv(); print("$4|$3|$2|$1");
dy|cy|by|ay
pncs
with the inline flag (-i, --inline
) to embed
C# script as a parameter. The previous example could be written as:
pncs -i 'readString("ax,bx,cx,dx");sed("x","y","ig");parseCsv();print("$4|$3|$2|$1");'
pncs
, typically around a second or two.