Coder Social home page Coder Social logo

Question - Custom HelpHooks about powerargs HOT 3 CLOSED

Geraint87 avatar Geraint87 commented on September 4, 2024
Question - Custom HelpHooks

from powerargs.

Comments (3)

adamabdelhamed avatar adamabdelhamed commented on September 4, 2024

Is it possible that you have 2 help hooks registered in your argument definition? Without looking at your complete code I can't imagine how this can happen. Your override code is not calling the base method so that base code should not execute.

If you share your complete code I can take a look.

Thanks,
Adam

from powerargs.

Geraint87 avatar Geraint87 commented on September 4, 2024

Thanks for getting back to me so quickly!

Yes, I did have two HelpHooks registered. I was trying both alongside each other to start with, with the Url one omitted from the usage:

        #region Global Options

        [HelpHook]
        [ArgShortcut("?")]
        public bool Help { get; set; }

        [ArgShortcut("~")]
        [OmitFromUsageDocs]
        [UrlHelpHook("myhelpurl.html")]
        public bool HelpUrl { get; set; }

        #endregion Global Options

So you can only have one?

At the moment, I have 3 action methods, with 4-6 arguments each - so the help text is getting too long for the console window.

Is there a way I could customise the usage, so that:

  1. At the top level (i.e. with no action specified, so myapplication -?) it just listed the actions and global options without recursively drilling down into each argument of each action?
  2. Have the context update itself so that myapplication myaction -? only returned the help usage for that action? (I see you've added SpecifiedAction to ArgUsageOptions, but it still isn't there in the AfterCancel of HelpHook.

If it would be possible to do this, I wouldn't need UrlHelpHook at all really!

Thanks!

from powerargs.

adamabdelhamed avatar adamabdelhamed commented on September 4, 2024

Fixed in 2.5.0.0

[HelpHook] will now automatically know if there was an action specified on the command line and will only show specific help for that action in that case.

from powerargs.

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.