Skip to content

Print command help on errors #53

@JonathanRiche

Description

@JonathanRiche

This is a great lib btw been liking working with it while building my CLI, have one question i'm going to be creating multiple subcommands and have got that working well no issue, however since .target only accepts either subommand or action im not sure of how to have a default command when the user just runs the cli ie blinkx in this case without running the subcommand

ie without the subcommand the user recieves this error ERROR: command 'blinkx' requires subcommand

id like to be able to either surface up the default help or something else by default is.

const app = CliBuilder.App{
        .command = CliBuilder.Command{
            .name = "blinkx",
            .options = &.{
                // Might be better to just have this as a defautl value
                
                .{
                    .long_name = "apikey",
                    .short_alias = 'a',
                    .help = "apikey to display",
                    .envvar = "BLINKX_APIKEY",
                    .required = true,
                    .value_ref = r.mkRef(&model.config.apikey),
                },
            },

            .target = CliBuilder.CommandTarget{
                .subcommands = &.{try content.contentCommand(&r)},

            },
        },
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions