Animated Circular Progress Bar0
Font.Lokio
CLI

Commands

Complete documentation of all available commands in Lokio CLI


Command Summary#

CommandAliasDescriptionShort Syntax
initInitialize Lokio in the current project directorylokio init
gengGenerate code from a templatelokio gen
addaAdd a new templatelokio add
edit <name>eEdit the configuration or contents of a templatelokio edit <name>
remove <name>rmRemove a templatelokio remove <name>

Global Options#

  • -V, --version Displays the Lokio CLI version.
  • -h, --help Displays help for a command.
  • -m, --multi A specific option for add to create multi-file templates.

Examples:

lokio --version
lokio --help
lokio add

init — Initialize Project#

Initializes Lokio in the current project directory, creating a basic configuration and folder structure for storing templates.

Syntax:

lokio init

Generated structure:

project/
├── lokio.yaml              # Project configuration
└── lokio/
    ├── configs.yaml        # List of templates
    └── templates/          # Folder for template files
        └── example.lokio   # Example template

Notes:

  • Run this command from your project's root directory.
  • The lokio.yaml and lokio/configs.yaml files should be included in version control to share with the team.

gen / g — Generate from Template#

Generates code based on a registered template. Use a template name specified in configs.yaml.

Syntax:

lokio gen <template> [name]
# Or alias:
lokio g <template> [name]
# Or simply:
lokio g

Parameters:

  • <template> The name of the template you want to use (e.g., screen, component, api).
  • [name] The name of the instance or entity being generated (optional, depending on the template definition).

Examples:

lokio g
# Runs the generator (depends on default configuration/template)
 
lokio g screen Home
# Generates code for the 'screen' template with the name 'Home'

Notes:

  • The output location follows the template definition (.lokio).
  • If the template requires additional input (variables), you will be prompted to provide it interactively or through configuration.

add / a — Add New Template#

Creates a new template inside the lokio/templates/ directory and registers it in configs.yaml.

Syntax:

lokio add <name> [--multi]
# Or alias:
lokio a <name> [--multi]
# Or simply:
lokio a

Options:

  • -m, --multi Creates a multi-file template (a structure with multiple files).

Examples:

lokio add component
# Adds a single-file template named 'component'
 
lokio add api --multi
# Adds a multi-file template named 'api'
 
lokio a
# Adds a template; next steps will prompt for input

Results:

  • A .lokio file (single-file) or template directory (multi-file) is created in lokio/templates/.
  • Template entries are automatically added/updated in lokio/configs.yaml.

edit / e — Edit Template#

Edit the contents or configuration of an existing template.

Syntax:

lokio edit <name>
# Or alias:
lokio e <name>

Example:

lokio edit component
# Opens/prepares editing for the template named 'component'

Notes:

  • Ensure the template name matches the one registered in configs.yaml.
  • After editing, test the template with lokio gen to ensure the output is as expected.

remove / rm — Remove Template#

Deletes a template from the project as well as its reference in configs.yaml.

Syntax:

lokio remove <name>
# Or alias:
lokio rm <name>

Example:

lokio rm component
# Removes the template named 'component'

Notes:

  • This action deletes the template files/directory from lokio/templates/.
  • Review the resulting changes before committing them to version control.

Integrated Usage Example#

# 1) Initialize Lokio for the project
lokio init
 
# 2) Add a multi-file template for API endpoints
lokio add api --multi
 
# 3) Edit the 'api' template if necessary (structure, variables, output path)
lokio edit api
 
# 4) Generate a new API endpoint named 'User'
lokio g api User

  • Include all configurations (lokio.yaml, lokio/configs.yaml) and contents of lokio/templates/ in version control.
  • Provide brief documentation for each template (purpose, variables, output location) to ensure all team members understand them.
  • Regularly review and update templates to maintain consistency and quality in team workflow.

Additional Information#

  • Quick help:
    lokio --help
    lokio <command> --help
  • Installed version:
    lokio --version