Code Monkey home page Code Monkey logo

Comments (9)

sairson avatar sairson commented on July 26, 2024 1

image

I may need to hide or delete registered commands during execution, and I find that you do not have the removal function, which means that I can only keep registering commands, but cannot remove them

from grumble.

skaldesh avatar skaldesh commented on July 26, 2024 1

We will add it!

from grumble.

skaldesh avatar skaldesh commented on July 26, 2024

Hi
Could you describe me the use case for this feature?

from grumble.

sairson avatar sairson commented on July 26, 2024

I have added a section to your source code that can be used to delete commands that have already been registered

image

from grumble.

skaldesh avatar skaldesh commented on July 26, 2024

I see. We have never needed something like that before. Would it be possible that instead of conditionally deleting a command, you conditionally add them?

from grumble.

sairson avatar sairson commented on July 26, 2024

But I think that having a function that deletes commands doesn't affect the program's functionality, and instead, it can be a helpful way for some people (like me). Of course it is possible to add a conditional command, but I find it more effective to remove a command because the program is required at some point

from grumble.

r0l1 avatar r0l1 commented on July 26, 2024

Instead of deleting/adding commands, what do you think about following approach:

grumble.Command{
    Name:      "daemon",
    Help:      "run the daemon",
    Aliases:   []string{"run"},

    Active: func() bool {
        // Executed to check the command active status.
        // ...
        return false;
    },
   // ...
}

from grumble.

sairson avatar sairson commented on July 26, 2024

I think this is a good approach, but adding a delete operation is not too much, because some people may have different requirements at the time of writing, and if you can add the above method, it is also easy to hide and reality the command line,thanks

from grumble.

skaldesh avatar skaldesh commented on July 26, 2024

remove command has been added

from grumble.

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.