New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Call back previous commands in interactive mode #57
Comments
There are a number of pure-Go readline implementations that could be integrated to allow this. |
This is the upstream repo for the pprof tool. The one in the Go distribution is an old snapshot of this codebase. We plan to eventually refresh it to a more recent version, I believe in Go 1.9 @dgryski : Any pointers to specific readline implementations? Are there any in use in the Go distribution? |
I have an initial prototype for this using github.com/chzyer/readline at Would you like to try it out and see if it is useful? It lets you recall and edit commands from the current session, but it doesn't provide a persistent history across sessions. Would you find this useful, or is cross-session history the most useful part? |
@rauls5382 Thanks for trying to build it! The workflow that I usually want this feature for is calling back the last command to add some filters. While cross-session history might be useful, it wasn't my goal. Sadly, I'm having some trouble running it. It compiles fine, but I can't open a profile with it. That said, I also can't open a profile with master. Has the profile format changed since the one shipping as |
No, pprof should still be able to read profiles from older versions. On Go 1.8 now the handlers generate a native profile, but pprof will continue to read profiles from older versions. If you can, attach a profile here and I can take a look. Did you collect it directly from the URL, or did you use pprof to fetch/save it? |
@rauls5382 I'm sorry, I did something stupid, and the profile file was empty. Anyway, it works ☁️ wonderfully ☁️. This is exactly what I wanted. Thank you so much! Is there any obstacle to adding this to master? |
There are some concerns with adding the new dependence to master. I'll work on it but it may take some time. Feel free to continue using my branch until then. |
Okay, thank you! |
Any news on this @rauls5382 ? I'd be happy to take on if you can't continue. As a workaround, |
@aalexand @nolanmar511 thoughts on this? Adding readline support should be relatively easy if some pure-go readline implementation is vendored; I guess the question here is whether it's fine to vendor a readline implementation or not. |
@ALTree pprof is vendored into Golang source tree so I am not enthusiastic about adding a new dependency for this feature request. I wonder if it should be relatively easy to implement some limited readline-like-support without adding a new dependency. |
Could we use https://github.com/golang/crypto/blob/master/ssh/terminal/terminal.go? That seems to have limited history support. Is that less problematic to depend on in golang land? |
I don't know if there is a desire to implement more readline features in the future but I would be very happy with only history support and just for the current session. If @rauls5382 or @levex are busy, I would be willing to pick this up and integrate crypto's terminal.go or just history. |
@rsc @hyangah @mvdan Do you see any issues (in terms of vendoring pprof into Go source tree) with pprof depending on https://github.com/golang/crypto/blob/master/ssh/terminal/terminal.go to implement limited history and editing support in the interactive mode? |
I don't know what the policy is around how much code can be vendored into the Go repository, sorry. I imagine Russ or other members of the Go team will have an opinion on it. |
Regarding vendoring in the terminal stuff, go for it. |
I'm sorry for the long silence on this. I think we can merge in my previous prototype while maintaining the existing version by default. I'll find some time to work on this. |
I believe that this repo is the code that powers
go tool pprof
. If I'm wrong on that count, disregard everything else I say.I'm using
pprof
on macOS 10.12.1 with go 1.7.3. I'm constantly using it in interactive mode, and it would be really nice to be able to call back previous commands with the "up" arrow key. Instead, of course, it prints^[[A
, which I assume means that this isn't supported?I completely understand if this isn't worth the development team's time, but I thought I would suggest it.
The text was updated successfully, but these errors were encountered: