Giter Site home page Giter Site logo

Run last printed command about navi HOT 10 CLOSED

denisidoro avatar denisidoro commented on May 7, 2024
Run last printed command

from navi.

Comments (10)

enisozgen avatar enisozgen commented on May 7, 2024 1

I'm not sure that would work because export won't apply to your main shell. It will apply to the bash shell that was triggered when calling the script.

So the second time one runs navi, the variable will be undefined.

As you say it is not possible to do it with export. I did it just as an example, it's not possible to do it since command opens different shell processes at background.

from navi.

denisidoro avatar denisidoro commented on May 7, 2024 1

Maybe #37 solves the same problem and we can close this issue? What do you think?

from navi.

aminehmida avatar aminehmida commented on May 7, 2024 1

I think what you want to do it is to put the command in the bash readline buffer so you have a chance to edit it before you press enter.

I am working on similar project related to AWS
This is very easy to do in zsh using print -z.

Unfortunately, I couldn't find a way to do that in Bash cross-platform (Linux/Mac OS)
Here is an issue in stackexchange maybe you will have better luck than me.

from navi.

welcome avatar welcome commented on May 7, 2024

Thanks for opening your first issue here!

from navi.

denisidoro avatar denisidoro commented on May 7, 2024

I'm not sure I got it. Your concern is with the --- syntax?

from navi.

enisozgen avatar enisozgen commented on May 7, 2024

I copied line from there https://github.com/denisidoro/navi/blob/master/cheats/docker.cheat#L40

As brief, I have just make new feature request like navi lastcommand which allows user to run last printed command via navi --print.

These command can be easy and safe for the peoples which is using the tool.

from navi.

denisidoro avatar denisidoro commented on May 7, 2024

I'm not sure that would work because export won't apply to your main shell. It will apply to the bash shell that was triggered when calling the script.

So the second time one runs navi, the variable will be undefined.

from navi.

forbesmyester avatar forbesmyester commented on May 7, 2024

It seems somewhat related... I want to run: . $(navi --print) But this doesn't seem to work (when the printed stuff includes export statements).

Whereas if I do . $(echo <what navi printed out>) it actually does work. Am unsure about what is happening in the middle, I haven't done enough digging to satisfy myself that it's a navi bug or a bug in the script navi is executing itself. Only adding it here as it may help with this issue

from navi.

enisozgen avatar enisozgen commented on May 7, 2024

Thank you for solution. Also, it gives ability to change the command before execution.

  1. I did small test about to being sure and found small problem. Cheatsheets which expect interactive input like type, port, name fails because of input not provided.
 Unable to fetch suggestions for 'type'! 

You can try this case via:
Ctrl-g write kubernetes type or netstat than press ENTER

  1. Just small warning about keybinding. Ctrl-g is already binded key for zsh. I never used it but just I am informing here
bindkey | grep get-line
"^[G" get-line
"^[g" get-line
  1. bindkey '\eg' _call_navi didn't worked for me! I used bindkey ^g _call_navi NOTE: This can be related with my machine.

from navi.

denisidoro avatar denisidoro commented on May 7, 2024

Closing in favor of #37

from navi.

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.