Comments (6)
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.
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.
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.
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.
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.
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)
- Escaped space not handled HOT 8
- Doesn't support empty quotes
- Setup Continous Integration HOT 3
- Nested quotes with no spaces not handled HOT 4
- v2.0.0 published a git repo HOT 1
- Feature request: support #-style comments
- Doesn't correctly handle nested quotes
- doesn't strip word-internal quotes
- separates unquoted tail of argument starting with quotes
- Missing license declaration HOT 2
- Missing license file HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from string-argv.