xacli-components 0.2.1

Interactive components for XaCLI
Documentation
cli {
    name = "components-demo"
    path = "./target/debug/examples/components_demo"
    alias = "demo"
}

example "confirm" {
    title = "Confirm Component Demo"
    description = "Interactive confirmation prompt with yes/no options"
    steps = [
        {
            description = "User confirms by pressing 'y'"
            commands = ["confirm"]
            input_events = [
                { key = "y" },
                { key = "Enter" }
            ]
        },
        {
            description = "User declines by pressing 'n'"
            commands = ["confirm"]
            input_events = [
                { key = "n" },
                { key = "Enter" }
            ]
        }
    ]
}

suite "confirm component tests" {
    test "basic confirmation with y" {
        description = "Test basic confirmation with 'y' key"
        commands = ["confirm"]
        input_events = [
            { key = "y" },
            { key = "Enter" }
        ]
        assertions = [
            { type = "contains", stream = "stdout", value = "Component returned: Bool(true)" }
        ]
    }

    test "cancellation with n" {
        description = "Test cancellation with 'n' key"
        commands = ["confirm"]
        input_events = [
            { key = "n" },
            { key = "Enter" }
        ]
        assertions = [
            { type = "contains", stream = "stdout", value = "Component returned: Bool(false)" }
        ]
    }

    test "direct enter uses default" {
        description = "Test pressing Enter directly uses default value"
        commands = ["confirm"]
        input_events = [
            { key = "Enter" }
        ]
        assertions = [
            { type = "contains", stream = "stdout", value = "Component returned: Bool(false)" }
        ]
    }
}