Hurl: Template File Generator
Table of Contents
Installation
Using npm:
npm install -g @hurl/cli
Using yarn:
yarn global add @hurl/cli
Commands
init
Initialize Hurl
Options
-
--skip
: Skip prompts and create default config- Type:
boolean
- Default: false
- Alias:
-s
- Type:
-
--examples
: Include example templates when creating config- Type:
boolean
- Default: true
- Alias:
-e
- Type:
Examples
-
Basic (with prompts & examples)
$ hurl init
Resulting folder structure:
project │ └───.hurl │ │ .hurl.<js|json|yml|ts> │ │ │ └───templates │ │ <language>-example.<js|ts> │ │ <language>-example.<js|ts> │ │ ...
-
Skip prompts
$ hurl init -s $ hurl init --skip $ hurl init --skip=true
Resulting folder structure:
project │ └───.hurl │ │ .hurl.json │ │ │ └───templates │ │ <empty>
-
Don't create example templates
$ hurl init -e=false $ hurl init --examples=false $ hurl init --no-examples
Resulting folder structure:
project │ └───.hurl │ │ .hurl.<js|json|yml|ts> │ │ │ └───templates │ │ <empty>
generate
Generate files from a template
Options
-
--paths
: The paths to the new files- Type:
string[]
- Alias:
-p
- Required
- Type:
-
--template
: The name of the template file/folder- Type:
string
- Alias:
-t
- Required
- Type:
-
--confirm
: Should confirm when overriding an existing file- Type:
boolean
- Default: true
- Type:
-
--<some-variable-name>
: Value for some template variable- Type:
string
- Type:
Examples
-
Create single file with no variables
$ hurl generate -p example.js -t template.js
-
Create multiple files with no variables
$ hurl generate -p example.js example2.js -t template.js
-
Create files with variables
$ hurl generate -p example.js -t example.js --var=value