CertainLach/jrsonnet

bug(cli): command completion generation requires `<INPUT>` parameter

JarvisCraft opened this issue · 3 comments

Description

Generating Clippy's tab-completions support requires the dummu <INPUT> parameter to be present.

Steps to reproduce

  1. Run
$ jrsonnet generate bash

bash can be replaced with any supported shell.

Expected behaviour

Tab-completion code is generated for the provided shell.

Observed behaviour

error: The following required arguments were not provided:
    <INPUT>

USAGE:
    jrsonnet [OPTIONS] <INPUT> [SUBCOMMAND]

For more information try --help

Tab-completion code is geneated only in presence of (any) <INPUT> parammeter value.

There was no default subcommand support in clap, so it wasn't possible to implement both

jrsonnet generate
jrsonnet file.jsonnet

clap-rs/clap#975

Now, as it is implemented, there would be two subcommands:

jrsonnet generate bash
jrsonnet compile file.jsonnet

And if subcommand is not specified, it should default to jrsonnet compile

Unfortunately, it seems to be still not possible to implement correctly with current clap api

Actually, found workaround.