Files
alkane-os/vendor/clap/examples/derive_ref/interop_tests.md
T
x ad31cfbafa Vendor flare-ui v0.2.9 and prove the schema-driven UI in an image
Spike, not the final UI: it answers whether flare-ui can drive Alkane OS's
on-box pages, and what it costs.

What works:

- schema/alkane-bb.json authors the sidebar as data (3 sections, 14 tabs);
- src/bin/ui-spike.rs renders it through flare_ui::nav + flare_ui::shell, so
  the unified sidebar, ordering and surface filtering come from the schema
  rather than from hand-written HTML;
- the render uses the shared bf- design tokens, the same ones the rest of the
  suite uses.

Size, measured rather than assumed (armv7, release, stripped):

  ui-baseline   323 KiB   (maud + serde_json, no flare-ui)
  ui-spike      771 KiB   (flare-ui + wschema + sha2)
  marginal      448 KiB

Vendoring: third-party/flare-ui is the full v0.2.9 tree pinned in
flare-ui/flare-ui.lock (a partial archive does not compile, since the crate
include_str!s assets from dash-editor/). vendor/ is re-generated as a cargo
directory source with the new registry dependencies (maud, sha2, typenum,
digest, generic-array, block-buffer, crypto-common, cfg-if, etc.) so the build
still works offline. third-party/README.md records how to re-pin.
2026-11-04 14:06:25 -06:00

3.8 KiB

Following are tests for the interop examples in this directory.

Augment Args

$ interop_augment_args
Value of built: false
Value of derived via ArgMatches: false
Value of derived: DerivedArgs {
    derived: false,
}

$ interop_augment_args -b --derived
Value of built: true
Value of derived via ArgMatches: true
Value of derived: DerivedArgs {
    derived: true,
}

$ interop_augment_args -d --built
Value of built: true
Value of derived via ArgMatches: true
Value of derived: DerivedArgs {
    derived: true,
}

$ interop_augment_args --unknown
? failed
error: unexpected argument '--unknown' found

Usage: interop_augment_args[EXE] [OPTIONS]

For more information, try '--help'.

Augment Subcommands

$ interop_augment_subcommands
? failed
error: a subcommand is required but one was not provided
$ interop_augment_subcommands derived
Derived subcommands: Derived {
    derived_flag: false,
}

$ interop_augment_subcommands derived --derived-flag
Derived subcommands: Derived {
    derived_flag: true,
}

$ interop_augment_subcommands derived --unknown
? failed
error: unexpected argument '--unknown' found

Usage: interop_augment_subcommands[EXE] derived [OPTIONS]

For more information, try '--help'.

$ interop_augment_subcommands unknown
? failed
error: unrecognized subcommand 'unknown'

Usage: interop_augment_subcommands[EXE] [COMMAND]

For more information, try '--help'.

Hand-Implemented Subcommand

$ interop_hand_subcommand
? failed
Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>

Commands:
  add     
  remove  
  help    Print this message or the help of the given subcommand(s)

Options:
  -t, --top-level  
  -h, --help       Print help

$ interop_hand_subcommand add
Cli {
    top_level: false,
    subcommand: Add(
        AddArgs {
            name: [],
        },
    ),
}

$ interop_hand_subcommand add a b c
Cli {
    top_level: false,
    subcommand: Add(
        AddArgs {
            name: [
                "a",
                "b",
                "c",
            ],
        },
    ),
}

$ interop_hand_subcommand add --unknown
? failed
error: unexpected argument '--unknown' found

  tip: to pass '--unknown' as a value, use '-- --unknown'

Usage: interop_hand_subcommand[EXE] add [NAME]...

For more information, try '--help'.

$ interop_hand_subcommand remove
Cli {
    top_level: false,
    subcommand: Remove(
        RemoveArgs {
            force: false,
            name: [],
        },
    ),
}

$ interop_hand_subcommand remove --force a b c
Cli {
    top_level: false,
    subcommand: Remove(
        RemoveArgs {
            force: true,
            name: [
                "a",
                "b",
                "c",
            ],
        },
    ),
}

$ interop_hand_subcommand unknown
? failed
error: unrecognized subcommand 'unknown'

Usage: interop_hand_subcommand[EXE] [OPTIONS] <COMMAND>

For more information, try '--help'.

Flatten Hand-Implemented Args

$ interop_flatten_hand_args
Cli {
    top_level: false,
    more_args: CliArgs {
        foo: false,
        bar: false,
        quuz: None,
    },
}

$ interop_flatten_hand_args -f --bar
Cli {
    top_level: false,
    more_args: CliArgs {
        foo: true,
        bar: true,
        quuz: None,
    },
}

$ interop_flatten_hand_args --quuz abc
Cli {
    top_level: false,
    more_args: CliArgs {
        foo: false,
        bar: false,
        quuz: Some(
            "abc",
        ),
    },
}

$ interop_flatten_hand_args --unknown
? failed
error: unexpected argument '--unknown' found

Usage: interop_flatten_hand_args[EXE] [OPTIONS]

For more information, try '--help'.