Skip to content

Commands

Available Commands

new

Create a new React Native app using the app template.

ok new <app-name>

Arguments: - app-name: Name of the app to create

Example:

ok new MyApp

generate

Generate components, services, or pages using predefined templates.

ok generate <type> <name>

Arguments: - type: Type of item to generate (component, service, page) - name: Name of the item to generate

Examples:

# Generate a component
ok generate component Button

# Generate a service
ok generate service ApiService

# Generate a page
ok generate page HomePage

makemessages

Extract i18n messages from source code via @lingui/cli extract. Mimics Django's makemessages.

ok makemessages [options]

Options: - --locale, -l: Locale(s) to process - --exclude, -x: Locale(s) to exclude - --all, -a: Update message files for all locales - --extension, -e: File extension(s) to examine (Django compat; not used by lingui) - --domain, -d: Message domain (Django compat; not used by lingui) - --symlinks, -s: Follow symlinks (Django compat; not used by lingui) - --ignore, -i: Ignore files/directories matching glob pattern - --no-default-ignore: Disable default ignore values (Django compat; not used by lingui) - --no-wrap: Disable line wrapping (Django compat; not used by lingui) - --no-location: Suppress source location comments (Django compat; not used by lingui) - --add-location: Control source location comments: full, file, or never (Django compat) - --no-obsolete: Remove obsolete message strings (maps to lingui's --clean) - --keep-pot: Keep temporary .pot files (Django compat; not used by lingui)

Example:

# Extract messages for Spanish locale
ok makemessages --locale es

# Extract messages and remove obsolete strings
ok makemessages --locale fr --no-obsolete

compilemessages

Compile .po files to .js/.ts catalogs via @lingui/cli compile. Mimics Django's compilemessages.

ok compilemessages [options]

Options: - --locale, -l: Locale(s) to process - --exclude, -x: Locale(s) to exclude - --use-fuzzy, -f: Include fuzzy translations (by default strict mode rejects them) - --ignore, -i: Ignore directories matching glob pattern (Django compat; not used by lingui)

Example:

# Compile all locale catalogs
ok compilemessages

# Compile with fuzzy translations allowed
ok compilemessages --use-fuzzy

translatemessages

Translate gettext .po files using gpt-po-translator. Forwards all remaining arguments to the underlying tool.

ok translatemessages [args...]

All trailing arguments are passed directly to gpt-po-translator. Run ok translatemessages --help to see the underlying tool's options.

Example:

# Run gpt-po-translator with its own arguments
ok translatemessages --source-lang en --target-lang es --input locale/es/LC_MESSAGES/django.po

Global Options

--help

Show help information for any command.

ok --help
ok new --help
ok generate --help

--version

Show the version of OK.

ok --version

Exit Codes

  • 0: Success
  • 1: Error occurred

Error Handling

The CLI provides clear error messages for common issues:

  • Invalid template type
  • Template not found
  • File system permissions
  • Missing dependencies

Template System

OK uses Copier for template processing, which supports:

  • Variable substitution ({{variable}})
  • Conditional blocks
  • File and directory templating
  • Custom hooks and filters