Skip to content

How do I print help info with colored command names? #478

Open
@ghost

Description

Hello! I'm having trouble finding a solution to this. Is something like this currently possible?

optparse-applicative version: 0.17.0.0

Currently, what I tried to so far -

import Options.Applicative (Parser, (<**>))
import qualified Options.Applicative as O
import qualified Options.Applicative.Help as OH

main :: IO ()
main = pure =<< O.customExecParser (O.prefs O.showHelpOnEmpty) opts
  where
    opts =
      O.info
        (myCommands <**> O.helper)
        ( O.fullDesc <> O.progDesc "")

myCommands :: Parser a
myCommands =
  O.subparser $
    O.command
      "myCommand"
      ( O.info
          O.empty
          (O.progDesc "description here")
      )
      <> O.style OH.green

but I got the "metavar" part of it colored green instead, not myCommand which is what I'm looking for:
image

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