xpd new util
Create a global utility rule, which any rule can use with matches: <name>
Use xpd new util to add a utility rule, which any rule of the project can use with
matches: <name>. It goes to the first folder that utilDirs in sgconfig.yml names.
$ xpd new project --yes --format json | jq -c .item"project"$ xpd new util print-call --lang python --pattern 'print($X)' --yesCreated util print-call created /tmp/project/utils/print-call.ymlxpd new util [OPTIONS] [NAME]Arguments
Section titled “Arguments”<NAME>
Section titled “<NAME>”<NAME>
The utility's name, which rules use as matches: <name>.
Options
Section titled “Options”--language
Section titled “--language”-l, --language <LANGUAGE>
The language of the code the utility matches.
Also written --lang.
Values: bash, c, cpp, csharp, css, dart, elixir, go, haskell, hcl, html, java, javascript, json, kotlin, lua, markdown, nix, php, python, ruby, rust, scala, solidity, swift, tsx, typescript, yaml, zig.
--pattern
Section titled “--pattern”-p, --pattern <PATTERN>
The code the utility matches.
--directory
Section titled “--directory”--directory <DIR>
The project folder, which holds sgconfig.yml. Nothing is written outside it. Default: the nearest folder at or above the current one with sgconfig.yml, or the current folder for a new project.
-y, --yes
Never ask. Fail when a required flag is missing.
--format
Section titled “--format”--format <FORMAT>
Print the result as text, or as JSON with createdFiles and modifiedFiles.
Default: text.
Values: text, json.