Git Product home page Git Product logo

Comments (6)

arpyzo avatar arpyzo commented on June 28, 2024 1

I think what he's looking for is recognition of the shell subcommand $(git ls-files) as a single parameter. I feel like this is beyond the scope of what this module is supposed to do.

from string-argv.

Cellule avatar Cellule commented on June 28, 2024

Just to be clear, is this the expected result you would want?

stringArgv('eslint `git ls-files`') === ["eslint", "git ls-files"]
stringArgv('eslint $(git ls-files)') === ["eslint", "git ls-files"]

This would need to be able to give custom start/end markers for arguments.
Unfortunately, I don't know how to implement the $( marker with a Regex since it has 2 characters.

It would be possible to parse the string manually instead of using a regex (essentially building a state machine myself).

I'll consider it if I can find some time to play around with it.

from string-argv.

gucong3000 avatar gucong3000 commented on June 28, 2024

is this the expected result you would want?

No.

expected result:

stringArgv('eslint `git ls-files`') === ["eslint", ["git", "ls-files"]]
stringArgv('eslint $(git ls-files)') === ["eslint", ["git", "ls-files"]]

or

stringArgv('eslint `git ls-files`') === ["eslint", "`git ls-files`"]
stringArgv('eslint $(git ls-files)') === ["eslint", "$(git ls-files)"]

See: https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html

from string-argv.

Cellule avatar Cellule commented on June 28, 2024

None of those expected results follow the current logic of argument parsing string-argv supports.
What are you trying to achieve exactly ?

If you have control over the input, you could do the following with the current implementation.

stringArgv('eslint "`git ls-files`"') === ["eslint", "`git ls-files`"]
stringArgv('eslint "$(git ls-files)"') === ["eslint", "$(git ls-files)"]

from string-argv.

gucong3000 avatar gucong3000 commented on June 28, 2024

What are you trying to achieve exactly ?What are you trying to achieve exactly ?

I was try to supports shell script for windows.

from string-argv.

Cellule avatar Cellule commented on June 28, 2024

In order to support this, I would have to allow custom start/end tokens for "quoted" values.
Right now the module only supports single and double quotes.
Adding support for custom start/end tokens (especially tokens with more than 1 character) would require a big revamp of the parsing logic of this module.
I feel it would add a lot of complexity for a module I am trying to keep as simple as possible.

For these reasons, I will not add support for this use-case

from string-argv.

Related Issues (12)

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.