Coder Social home page Coder Social logo

Comments (4)

mdemoss avatar mdemoss commented on August 16, 2024

Maybe all that can be done is to document the --

After giving it some thought, trying to do what coreutils echo and some others do (echo "-n-" works and echo "-n" does not) is a little inconsistent so documenting really may be best.

from libqrencode.

PhilterPaper avatar PhilterPaper commented on August 16, 2024

On many systems' command line input, -x and --xyz, whether or not within single or double quotes, will be interpreted as command line options. --test is no different from "--test", it will see -- and try to treat it as an option. If you put the text within quotation marks (double quotes), you can often escape the string and tell the command line or script interpreter not to use it as a command line option: "\--test". Inconvenient, but a possible workaround.

from libqrencode.

charmander avatar charmander commented on August 16, 2024

If you put the text within quotation marks (double quotes), you can often escape the string and tell the command line or script interpreter not to use it as a command line option: "\--test".

@PhilterPaper That’s not how it works either – the program will just see the string \--test with a literal backslash (since \- isn’t a meaningful double-quoted escape sequence) and produce the wrong output.

The -- end-of-options marker is the correct solution, and is a well-established standard.

from libqrencode.

PhilterPaper avatar PhilterPaper commented on August 16, 2024

That's why I added the caveat often when talking about command line strings with a leading "-". It's going to be handled by the application, not by the OS, and it may or may not see the "escape". As an example of where this does work, see "grep" (at least, the Windows implementation). grep -S "--test--" filepattern will complain about an illegal option, but grep -S "\--test--" filepattern works correctly. It's something the OP might give a try just to see if it works for them.

A formal end-of-options marker, if implemented, would be the proper way to do it (and is not a "workaround").

from libqrencode.

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.