YINI CLI
Validate, inspect, and convert YINI files from the command line.
The YINI CLI is the official command-line tool for working with YINI files. It is designed to make everyday configuration work simple and predictable β whether you want to quickly inspect a file, validate it, or convert it to JSON, JavaScript, YAML, or XML.
As of yini-cli 1.5.0+, the CLI is aligned with the YINI 1.0.0 RC 6 specification.
If you prefer configuration that stays readable without depending on indentation, YINI CLI gives you a straightforward way to work with it from your terminal.
- For the command reference, see YINI CLI usage.
Why use YINI CLI?
YINI CLI is useful when you want to:
- Validate configuration files before running an app or deploying.
- Inspect YINI files quickly from the terminal.
- Convert YINI into JSON, JavaScript, YAML, or XML for tooling and automation.
- Work with configuration that stays explicit, structured, and easy to read.
It is especially helpful for developer workflows, scripts, CI checks, and local debugging.
Install
You can either run YINI CLI directly with npx or install it globally.
Try it instantly with npx
npx yini-cli --helpThis is the quickest way to try the CLI without installing it globally.
Install globally with npm
Install the CLI globally with npm:
npm install -g yini-cliAfter installation, you can verify that it works with:
yini --version
yini --helpFor the full command help and option reference, see the YINI CLI command reference.
Quick example
Suppose you have a file called config.yini:
^ App
name = "My App Title"
version = "1.2.3"
pageSize = 25
darkTheme = offYou can parse it like this:
yini parse config.yiniOutput:
{
"App": {
"name": "My App Title",
"version": "1.2.3",
"pageSize": 25,
"darkTheme": false
}
}Common commands
These are the most common yini-cli commands.
Parse a YINI file
yini parse config.yiniOutput compact JSON
yini parse config.yini --compactOutput formatted JSON explicitly
yini parse config.yini --jsonOutput JavaScript-style object syntax
yini parse config.yini --jsOutput YAML
yini parse config.yini --yamlOutput XML
yini parse config.yini --xmlWrite output to a file
yini parse config.yini -o out.jsonValidate a file
yini validate config.yiniValidate a file in strict mode
yini validate --strict config.yiniValidate the current directory
Validates all YINI files in the current directory and its subdirectories.
yini validate .Validate multiple files or directories
yini validate config.yini site-config.yini src/contentShow CLI environment information
yini infoExample: Validating one YINI file
To validate one specific YINI file, pass the file path to the validate command:
yini validate config.yinior, without installing the CLI globally:
npx yini-cli@latest validate config.yiniExample terminal output:
D:\...\my-project>yini validate config.yini
β Validation successful
File: "config.yini"
Mode: lenient
Errors: 0
Warnings: 0You can also validate a file inside a subdirectory:
yini validate config/site-config.yiniNote: This output is only an example. The exact output may differ depending on your
yini-cliversion, your operating system, and your file path.
Example: Validating one YINI file with a warning
A YINI file can still be valid even if the validator reports a warning.
For example, this command validates one specific file:
yini validate basic1.yiniExample terminal output:
basic1.yini
β Validation successful (with warnings)
File: "basic1.yini"
Mode: lenient
Errors: 0
Warnings: 1
"basic1.yini"
warning No newline at end of file.
It's recommended to end a YINI file with a newline.In this example, the file has no errors, so validation succeeds. The warning only says that the file should end with a newline.
Warnings are useful because they point out things that are allowed, but may be worth fixing for consistency or readability.
Note: This output is only an example. The exact output may differ depending on your
yini-cliversion, operating system, and file path.
Example: Validating all YINI files
To validate all YINI files in the current directory and its subdirectories, run one of these commands:
yini validate .or, without installing the CLI globally:
npx yini-cli@latest validate .Example terminal output:
D:\...\src\content>yini validate .
OK "examples\advanced\3-cli-application-options.yini"
OK "examples\advanced\5-database-connection.yini"
OK "examples\advanced\6-feature-flags-example.yini"
OK "examples\advanced\7-email-smtp-configuration.yini"
OK "examples\basic\basic1.yini"
OK "examples\basic\basic2.yini"
OK "examples\basic\basic3.yini"
OK "examples\basic\basic4.yini"
OK "examples\basic\comments.yini"
OK "examples\basic\hello-world.yini"
OK "examples\basic\settings.yini"
OK "examples\data-types\inline-objects\big-inline-object.yini"
OK "examples\general\general.yini"
OK "examples\general\lists-and-objects.yini"
OK "examples\general\lists-and-sections.yini"
OK "examples\general\number-formats.yini"
OK "examples\general\strings-and-escapes.yini"
OK "examples\indentation\indent-ex-conf1.yini"
OK "examples\indentation\indent-ex-conf2.yini"
OK "examples\indentation\indent-ex-conf3.yini"
OK "examples\large-smoke-fixtures\a-corporate-saas-platform.smoke.yini"
OK "examples\large-smoke-fixtures\b-high-security-distributed-control-system.smoke.yini"
OK "examples\real-world\1-web-server-configuration.yini"
OK "examples\real-world\2-user-profile-settings.yini"
OK "examples\real-world\4-build-project-configuration.yini"
OK "examples\real-world\sim-config.yini"
OK "examples\structure\nested-and-structured.yini"
OK "examples\structure\nested-sections.yini"
OK "examples\structure\sections.yini"
Base: "D:\...\src\content"
Mode: lenient
Summary: 29 checked, 0 failed, 0 errorsNote: This output is only an example. The exact output may differ depending on your
yini-cliversion and your directory structure.
A quick look at the YINI format
YINI is a human-friendly configuration format with explicit structure, nested sections, comment support, and predictable parsing.
// This is a comment in YINI
^ App
name = 'My Title'
items = 25
darkMode = true
^^ Special
primaryColor = 0x336699
isCaching = falseThat becomes:
{
App: {
name: 'My Title',
items: 25,
darkMode: true,
Special: {
primaryColor: 3368601,
isCaching: false
}
}
}When YINI CLI is a good fit
YINI CLI is a good fit if you want:
- A simple command-line tool for structured configuration.
- Human-readable config files without indentation-based structure.
- Easy conversion to JSON, JavaScript, YAML, or XML.
- A clear way to validate configuration during development or deployment.
Learn more
- β‘οΈ YINI format overview
What YINI is and why it exists. - β‘οΈ Learn the YINI syntax
A simple introduction to sections, values, nesting, and comments. - β‘οΈ Examples
See YINI examples from simple to more advanced. - β‘οΈ YINI Specification
The formal specification for the YINI format.
Links
If you want to try the CLI or explore the project further, these links are a good place to continue.
