Giter Club home page Giter Club logo

Comments (3)

c-bata avatar c-bata commented on May 16, 2024

Hi @fhemberger!
Thank you for using kube-prompt.
The answer is Ctrl-D. But maybe it is a little hard to notice.

I'll consider the better way.

from go-prompt.

c-bata avatar c-bata commented on May 16, 2024

By implementing exit or quit command in go-prompt, it may be conflict with something features.
For example, kube-prompt supports kubectl exec command. By using this, we can login to the container managed by kubernetes like:

$ kube-prompt
>>> exec -it <pod name> bash  # login to the container.
bash-$ pwd
/home/foo
bash-$ exit  # logout
>>> 

In this pattern, the user just wanted to logout and the user doesn't want to quit kube-prompt. So now I think exit and quit command should be implemented in kube-prompt like:

func completer(d prompt.Document) []prompt.Suggest {
    // returns something suggestions.
}

func executor(in string) {
    if in == "exit" {
        // quit this program.
    }
    // execute something command.
    return
}

func main() {
    pt := prompt.New(executor, completer)
    pt.Run() 
}

from go-prompt.

c-bata avatar c-bata commented on May 16, 2024

I decided the go-prompt doesn't provide other way to exit and this problem on kube-prompt is fixed like:
c-bata/kube-prompt#7

If you want to add the way to exit, please refer following changes:
c-bata/kube-prompt@e3ab4f4

Thanks.

from go-prompt.

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.