Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single dash options #147

Open
vjpr opened this issue Nov 16, 2022 · 4 comments
Open

Single dash options #147

vjpr opened this issue Nov 16, 2022 · 4 comments

Comments

@vjpr
Copy link

vjpr commented Nov 16, 2022

I'm trying to parse a clang string with -DMI_SKIP_COLLECT_ON_EXIT=1 -DMI_STATIC_LIB.

But I don't want to define a schema. I just want to get -DMI_SKIP_COLLECT_ON_EXIT=1 as a token, then I will process it myself.

Would it be possible to add an option that says: use single dash instead of double-dash?

@shadowspawn

This comment was marked as off-topic.

@bakkot

This comment was marked as resolved.

@shadowspawn

This comment was marked as resolved.

@shadowspawn
Copy link
Collaborator

I am not sure I understand your use case, but I'll give a simple example of how you could parse the clang macro definitions. You can explain further if this does not help.

const { parseArgs } = require('util');

const result = parseArgs({ options: {
    D: { type: 'string', multiple: true }
}});

console.log(result.values);
$ node index.js -DMI_SKIP_COLLECT_ON_EXIT=1 -DMI_STATIC_LIB
[Object: null prototype] {
  D: [ 'MI_SKIP_COLLECT_ON_EXIT=1', 'MI_STATIC_LIB' ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants