optify-cli 1.1.3

CLI for inspecting and querying Optify configuration options.
optify-cli-1.1.3 is not a library.

Optify CLI

A command-line tool for inspecting and querying Optify configuration options.

Installation

cargo install optify-cli

Or build from source:

cargo build --release

The binary will be at target/release/optify.

Usage

optify --dir <DIR> [--dir <DIR>...] [--schema <PATH>] <COMMAND>

Output is always compact single-line JSON. Use jq to pretty-print or further process the output:

optify --dir ./configs get-options -k myConfig -f A | jq

Global Options

Option Description
-d, --dir <DIR> Path to a configuration directory. Repeat to load from multiple directories.
--schema <PATH> Optional path to a JSON schema file for validating configurations.

list-features

List all features with their metadata as a JSON array.

optify --dir ./configs list-features
# [{"aliases":["short"],"details":...,"name":"featureName","owners":"team@co.com",...}, ...]

optify --dir ./configs list-features | jq '.[].name'
# "featureA"
# "featureB"

get-options

Get the options for a specific configuration key, merged across the given features (last feature wins).

optify --dir ./configs get-options --key myConfig --features A B

Feature names with spaces must be quoted:

optify --dir ./configs get-options -k myConfig -f "feature with spaces" A

get-all-options

Get the full merged configuration for the given features.

optify --dir ./configs get-all-options --features A B

--preferences / --prefs

Both get-options and get-all-options accept a --preferences (or --prefs) flag with a JSON value. This maps directly to the GetOptionsPreferences struct, so any new fields added to the struct are automatically available.

# Enable configurable string resolution
optify --dir ./configs get-options -k myConfig -f A --prefs '{"are_configurable_strings_enabled": true}'

# Apply overrides on top of the merged configuration
optify --dir ./configs get-all-options -f A --prefs '{"overrides": {"myConfig": {"key": "value"}}}'

# Filter features by constraints
optify --dir ./configs get-options -k myConfig -f A B --prefs '{"constraints": {"constraints": {"client": "Android"}}}'

Examples

# List features with metadata in a config directory
optify --dir tests/test_suites/simple/configs list-features | jq

# Get options for the "myConfig" key with feature A active
optify --dir tests/test_suites/simple/configs get-options -k myConfig -f A

# Get options for the "myConfig" key with features A and B active (B overrides A)
optify --dir tests/test_suites/simple/configs get-options -k myConfig -f A B

# Pretty-print with jq
optify --dir tests/test_suites/simple/configs get-options -k myConfig -f A | jq

# Get the full merged configuration for features A and B
optify --dir tests/test_suites/simple/configs get-all-options -f A B

# Load from multiple directories
optify --dir ./base-configs --dir ./override-configs get-options -k myConfig -f A

Testing

cargo test

Formatting

cargo fmt && cargo clippy --fix --allow-dirty --allow-staged