Git Product home page Git Product logo

Comments (5)

Tyrrrz avatar Tyrrrz commented on August 25, 2024

Hey, thanks a lot! Glad you're enjoying it.

It's currently not possible to trigger help manually, although I have an idea how to implement it.

To understand your scenario a bit better, is your code available on GitHub or somewhere else I could take a look at? Or maybe you can give me a more applied example which involves real command names, etc?

from clifx.

domn1995 avatar domn1995 commented on August 25, 2024

Here's a really simple example repo I created:
https://github.com/domn1995/HelpTextExample

Current output

>app command1
>
>app command1 sub1
Doing work...

As you can see, the output of the first command is blank. I would like to show the help text there instead.

Desired output

>app command1
Usage
  app command1 [command]

Options
  -h|--help         Shows help text.

Commands
  sub1

You can run `app command1 [command] --help` to show help on a specific command.
>app command1 sub1
Doing work...

Essentially, since command1 doesn't actually do any work, it just "organizes" the command line structure, I would like to show its help text when no arguments are given to make it clear to the user that this command doesn't really do anything.

If this is a feature that you believe would benefit the project, I would love to submit a PR. Just point me in the right direction.

Cheers!

from clifx.

Tyrrrz avatar Tyrrrz commented on August 25, 2024

My first idea is to extend the CommandException with an extra parameter ShowHelp, which would get inspected by CliApplication. Then you would be able to do:

[Command("docker container")]
public class ContainerCommand : ICommand
{
    public ValueTask ExecuteAsync(IConsole consonle) =>
        throw new CommandException("Please specify a command.", showHelp: true);
}

from clifx.

domn1995 avatar domn1995 commented on August 25, 2024

I like it. Do you want me to create a new issue for the feature and submit a PR?

from clifx.

Tyrrrz avatar Tyrrrz commented on August 25, 2024

Sure, go ahead.

from clifx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.