GithubHelp home page GithubHelp logo

Comments (4)

olets avatar olets commented on July 29, 2024 1

Makes sense, thanks for reporting! Yes, the expansions get saved to the user file wrapped in double quotes. The original quote level should be preserved if possible.

It'll be probably a couple weeks before I'm able to look into it. In the meantime, single quotes will work too if you don't want to gunk up your command with slashes, and the echo's will work without quotes. And it's outside my wheelhouse but in at least some circumstances kubectl's --selector doesn't need quotes.

Cool use case, I hadn't thought to use a single abbreviation for a string of commands. I like it.

from zsh-abbr.

philwhln avatar philwhln commented on July 29, 2024

Looking in ~/.config/zsh/abbreviations, I can see the single quotes have been replaced with double-quotes.

abbr nodes="echo "MASTERS" && kubectl get nodes --selector="kubernetes.io/role=master" && echo "REGULAR NODES" && kubectl get nodes --selector="kubernetes.io/role!=master,dedicated!=heavy" && echo "HEAVY NODES" && kubectl get nodes --selector="kubernetes.io/role!=master,dedicated=heavy""

from zsh-abbr.

philwhln avatar philwhln commented on July 29, 2024

Editing this file to escape the quotes fixes the error, so the solution would seem to be doing this escaping of double quotes on persisting the values.

abbr nodes="echo \"MASTERS\" && kubectl get nodes --selector=\"kubernetes.io/role=master\" && echo \"REGULAR NODES\" && kubectl get nodes --selector=\"kubernetes.io/role!=master,dedicated!=heavy\" && echo \"HEAVY NODES\" && kubectl get nodes --selector=\"kubernetes.io/role!=master,dedicated=heavy\""

from zsh-abbr.

olets avatar olets commented on July 29, 2024

Fixed in 3.1.2!

If you version control your user abbreviations file you'll probably see some noise after the first time you make a change to any user abbreviations via the command line (ie after the first time abbr updates the user file) — more double quotes, more \s. You don't have to change the way you write expansions, either interactively or editing the user abbrevations file directly — zsh will figure out the quoting / escaping as needed.

from zsh-abbr.

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.