Skip to content

Command Reference

LoSkroefie edited this page Jan 19, 2025 · 1 revision

Command Reference

Global Options

These options apply to all commands:

--help, -h      Show help information
--version, -v   Show version information
--quiet, -q     Suppress output except errors
--verbose       Show detailed output
--no-color      Disable colored output

Commands

encode

Convert JSON to FLEXON format.

flexon-cli encode [options] <input> <output>

Options:

--compress, -c              Enable compression
--compression-level <1-9>   Set compression level (default: 6)
--schema <file>            Validate against schema during encoding
--type-check               Enforce strict type checking
--no-validation           Skip validation checks

Example:

# Basic encoding
flexon-cli encode input.json output.flexon

# With compression
flexon-cli encode -c input.json output.flexon

# With schema validation
flexon-cli encode --schema schema.json input.json output.flexon

decode

Convert FLEXON to JSON format.

flexon-cli decode [options] <input> <output>

Options:

--pretty, -p               Pretty print JSON output
--indent <spaces>         Set indentation (default: 2)
--type-hints             Include type information comments
--encoding <encoding>     Specify output encoding (default: UTF-8)

Example:

# Basic decoding
flexon-cli decode input.flexon output.json

# Pretty printed output
flexon-cli decode -p input.flexon output.json

# Custom indentation
flexon-cli decode --pretty --indent 4 input.flexon output.json

inspect

Examine FLEXON file contents.

flexon-cli inspect [options] <input> [output]

Options:

--format <json|text>      Output format (default: text)
--detailed, -d           Show detailed type information
--structure              Show structure overview
--stats                  Show statistics

Example:

# Basic inspection
flexon-cli inspect data.flexon

# Detailed JSON output
flexon-cli inspect --format json --detailed data.flexon

# Save inspection report
flexon-cli inspect --stats data.flexon report.txt

validate

Validate FLEXON file against schema.

flexon-cli validate [options] <input> <schema>

Options:

--strict                 Enable strict validation
--format <text|json>     Error format (default: text)
--max-errors <number>    Maximum errors to report (default: 10)
--ignore-unknown        Ignore unknown properties

Example:

# Basic validation
flexon-cli validate data.flexon schema.json

# Strict validation with JSON output
flexon-cli validate --strict --format json data.flexon schema.json

benchmark

Run performance benchmarks.

flexon-cli benchmark [options] [input]

Options:

--operation <serialize|deserialize>   Operation to benchmark
--iterations <number>                Number of iterations
--size <bytes>                      Test data size
--compare                           Compare with other formats

Example:

# Basic benchmark
flexon-cli benchmark data.flexon

# Specific operation benchmark
flexon-cli benchmark --operation serialize --iterations 1000 data.flexon

convert

Batch convert files between formats.

flexon-cli convert [options] <source> <destination>

Options:

--recursive, -r          Process directories recursively
--pattern <pattern>      File pattern to match
--preserve              Preserve directory structure
--overwrite            Overwrite existing files

Example:

# Convert directory
flexon-cli convert --recursive source/ destination/

# Convert specific files
flexon-cli convert --pattern "*.json" source/ destination/

Environment Variables

  • FLEXON_HOME: Installation directory
  • FLEXON_CONFIG: Configuration file location
  • FLEXON_SCHEMA_PATH: Schema search path
  • FLEXON_COMPRESSION: Default compression level
  • FLEXON_NO_COLOR: Disable colored output

Configuration File

Default location: ~/.flexon/config.json

{
  "compression": {
    "enabled": true,
    "level": 6
  },
  "validation": {
    "strict": false,
    "maxErrors": 10
  },
  "output": {
    "color": true,
    "format": "text",
    "indent": 2
  }
}

Exit Codes

  • 0: Success
  • 1: General error
  • 2: Invalid arguments
  • 3: File error
  • 4: Schema error
  • 5: Validation error
  • 6: Permission error

Clone this wiki locally