zio-cli icon indicating copy to clipboard operation
zio-cli copied to clipboard

--help does not show subcommand description if there are any other parameters present

Open senia-psm opened this issue 2 years ago • 5 comments

Reproducer:

  private val param = Options.text("param")

  override def cliApp: CliApp[Any with ZIOAppArgs with Scope, Any, Any] =
    CliApp.make(
      "test",
      "0.1.0",
      HelpDoc.Span.text("Reproduce --help issue"),
      command = Command("test", param).subcommands(
        Command("a")
          .subcommands(
            Command("b")
          )
          .map { _ => () }
      )
    ) { _ => ZIO.unit    }

Expected behaviour: result for a --help and --param text a --help should be the same - help for a subcommand.

Actual result: --param text a --help shows root doc instead.

Correct result:

$ ./bin/test a --help
...

USAGE

  $ test a b

COMMANDS

  b  

Incorrect result:

$ ./bin/test --param text a --help
...
USAGE

  $ test --param text a b

OPTIONS

  --param text
    A user-defined piece of text.

COMMANDS

  a  

See minimal reproducer here: https://github.com/senia-psm/zio-cli-222

senia-psm avatar Jul 07 '23 16:07 senia-psm

/bounty $100

jdegoes avatar Jul 10 '23 14:07 jdegoes

💎 $100 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #222 with your implementation plan
  2. Submit work: Create a pull request including /claim #222 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-cli!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @pablf #295

algora-pbc[bot] avatar Jul 10 '23 14:07 algora-pbc[bot]

@jdegoes @adamgfraser Please assign this to me.

ithinkicancode avatar Jul 10 '23 18:07 ithinkicancode

@ithinkicancode Done!

adamgfraser avatar Jul 10 '23 19:07 adamgfraser

💡 @pablf submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Feb 21 '24 08:02 algora-pbc[bot]