yini-cli
v1.1.1-beta
Published
CLI for parsing and validating YINI config files: type-safe values, nested sections, comments, minimal syntax noise, and optional strict mode.
Maintainers
Readme
YINI-CLI
Command-line tool for validating, inspecting, and converting YINI configuration files to JSON.
YINI is an INI-inspired configuration format designed for clarity and predictability. It supports nesting, comments, and a formally defined syntax, so configuration files stay easy to read and reason about as they grow.
This tool is useful if you work with human-edited configuration files and want predictable structure without indentation-based rules.
Quick Start
Requirements
YINI CLI requires Node.js v20 or later.
(It has also been tested with Node.js v13+, but v20+ is recommended for best compatibility.)
Installation
Install it globally from npm — (requires Node.js)
Open your terminal and run:npm install -g yini-cliVerify installation
Run this in your terminal:yini --versionShould print the version (e.g., 1.0.0).
Then you may try:
yini --helpShould show you the CLI help for YINI.
Test functionality
Create a simple test file, for example:config.yini:^ App name = "My App Title" version = "1.2.3" pageSize = 25 darkTheme = offThen run:
yini parse config.yiniExpected result, your CLI should output a parsed version of the config and output something similar to:
{ App: { name: 'My App Title', version: '1.2.3', pageSize: 25, darkTheme: false } }
⭐ If this was useful, star it on GitHub — it helps a lot, thank you!
Typical use cases
- Validating configuration files during development or CI.
- Inspecting and debugging structured configuration.
- Converting YINI files to JSON for tooling and automation.
🙋♀️ Why YINI?
- Indentation-independent structure: The YINI config format is indentation-independent, meaning any space or tab never changes meaning.
- Explicit nesting: It uses clear header markers (
^,^^,^^^) to define hierarchy (like in Markdown), without long dotted keys. - Multiple data types: Supports boolean literals (
true/false,Yes/No, etc), numbers, arrays (lists), and JS-style objects natively, with explicit string syntax. - Comments support: YINI supports multiple comment styles (
#,//,/* ... */, and;) allowing one to document config directly in the file. - Predictable parsing rules: Well-defined rules with optional strict and lenient modes, for different use-requirements.
Usage of command yini
Usage: yini [options] [command]
CLI for parsing and validating YINI config files.
Options:
-v, --version Output the version number.
-i, --info Show extended information (details, links, etc.).
-s, --strict Enable strict parsing mode.
-f, --force Continue parsing even if errors occur.
-q, --quiet Reduce output (show only errors).
--silent Suppress all output (even errors, exit code only).
-h, --help Display help for command.
Commands:
parse [options] <file> Parse a YINI file (*.yini) and print the result.
validate [options] <file> Checks if the file can be parsed as valid YINI.
info Deprecated: Use `yini --info` or `yini -i` instead.
help [command] Display help for command.
Examples:
$ yini parse config.yini
$ yini validate --strict config.yini
$ yini parse config.yini --pretty --output out.json
For help with a specific command, use -h or --help. For example:
$ yini validate --helpQuick Look at YINI
Here's a small example showing YINI structure and comments:
// This is a comment in YINI
^ App // Defines section (group) "App"
name = 'My Title' // Keys and values are written as key = value
items = 25
darkMode = true // "ON" and "YES" works too
// Sub-section of the "App" section
^^ Special
primaryColor = #336699 // Hex number format
isCaching = false // "OFF" and "NO" works too
# This is a comment too.The above YINI converted to a JS object:
{
App: {
name: 'My Title',
items: 25,
darkMode: true,
Special: {
primaryColor: 3368601,
isCaching: false
}
}
}In JSON:
{
"App":{
"name":"My Title",
"items":25,
"darkMode":true,
"Special":{
"primaryColor":3368601,
"isCaching":false
}
}
}That's it!
📤 Output Modes for yini parse
The parse command supports multiple output styles:
| Command Example | Output Style | Description |
|----------------------------------------------------|----------------------|------------------------------------------------------------------------------|
| yini parse config.yini | JS-style object | Uses Node’s util.inspect — human-readable, shows types, nesting, etc. |
| yini parse config.yini --pretty | Pretty JSON | Formatted and indented with JSON.stringify(obj, null, 4). |
| yini parse config.yini --json | Compact JSON | Compact and machine-friendly JSON.stringify(obj). |
| yini parse config.yini --output out.txt | File (JS-style) | Default style, written to specified file. |
| yini parse config.yini --pretty --output out.json| File (Pretty JSON) | Formatted JSON written to file. |
💡 Tip: You can combine --output with any style flag to control both formatting and destination.
🛠 Roadmap
Areas of planned and possible future expansion:
- Improve existing commands — Continued functionality improvements, better diagnostics, and expanded QA for
parseandvalidateand their options. - Command
format: Pretty-print or normalize a.yinifile. - Command
lint: Stricter stylistic checks (likevalidate, but opinionated). - Command
diff: Compare two YINI files and show structural/config differences. - Command
convert: Convert aJSONorXMLfile into YINI format.
Links
➡️ YINI Parser on npm
Install and view package details.➡️ YINI Project
YINI home on gitHub.
Contribution & Involvement
Interested in contributing or trying ideas? Issues, feedback, and experiments are welcome — even small ones.
License
This project is licensed under the Apache-2.0 license - see the LICENSE file for details.
In this project on GitHub, the libs directory contains third party software and each is licensed under its own license which is described in its own license file under the respective directory under libs.
If you found this useful, a GitHub star helps the project a lot ⭐
^YINI ≡
YINI — Clear, Structured Configuration Files.
