Skip to content

Command-line tool for working with YINI files (clean, type-safe config format with nested sections). Validate, inspect, and convert to JSON with pretty output.

License

Notifications You must be signed in to change notification settings

YINI-lang/yini-cli

Repository files navigation

YINI-CLI

Command-line tool for working with YINI configuration files. Validate, inspect, and convert to JSON with pretty output.

YINI aims to be a human-friendly config format: like INI, but with type-safe values, nested sections, comments, minimal syntax noise, and optional strict mode.

npm version All Tests


🙋‍♀️ Why YINI?

  • YINI is an alternative to other great config formats like INI, JSON, YAML, XML, and TOML — designed for clarity, simplicity, and straightforward section nesting.
  • Started as a personal project and a research challenge: Provides structure similar to INI, with features inspired by JSON and YAML.
  • Built for clarity:
    • Uses concise syntax designed for clarity, especially in nested sections.
    • Supports commonly used configuration structures.
  • *Developed to meet practical needs, driven by curiosity and a desire for configuration clarity, simplicity, minimalism, and flexibility.

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.)


💡 What is YINI?

  • INI-inspired — with added support for typing, comments, and nested sections.
  • Uses minimal syntax — yet aims to keep maximum clarity.
  • Section nesting without requiring indentation or dot-delimited keys.
  • Supports strict and lenient modes, and all major data types.
  • Designed for compatibility with both manual editing and automation.
  • 👉 See how YINI differs from JSON, YAML, INI, and TOML.
  • Want the full syntax reference? See the YINI Specification.

Quick Into to YINI Format

YINI code looks like this:

    // This is a comment in YINI
    // YINI is a simple, human-readable configuration file format.

    // Note: In YINI, spaces and tabs don't change meaning - indentation is just
    // for readability.

    /*  This is a block comment

        In YINI, section headers use repeated characters "^" at the start to
        show their level: (Section header names are case-sensitive.)

        ^ SectionLevel1
        ^^ SectionLevel2
        ^^^ SectionLevel3
    */

    ^ App                      // Definition of 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

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!


Bigger Intro into YINI Config Format

YINI is a simple and readable configuration format. Sections are defined with ^ SectionName, and values are assigned using key = value. The format supports common data types (same as those found in JSON), including strings, numbers, booleans, nulls, and lists.

To learn more, see the Getting Started: Intro to YINI Config Format tutorial.


Usage

Installation

  1. Install it globally from npm — (requires Node.js)
    Open your terminal and run:

    npm install -g yini-cli
    
  2. Verify installation
    Run this in your terminal:

    yini --version

    Should print the version (e.g., 1.0.0).

    Then you may try:

    yini --help

    Should show you the CLI help for YINI.

  3. Test functionality
    Create a simple test file, for example: config.yini:

    ^ App
      name = "My App Title"
      version = "1.2.3"
      pageSize = 25
      darkTheme = off
    

    Then run:

    yini parse config.yini

    Expected 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
        }
    }    

📤 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.


Links


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.


~ YINI ≡https://yini-lang.org

About

Command-line tool for working with YINI files (clean, type-safe config format with nested sections). Validate, inspect, and convert to JSON with pretty output.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published