Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: add parsed meta-data to returned properties #129
feat: add parsed meta-data to returned properties #129
Changes from 61 commits
52c3a2e
5ec71b1
f711187
cce90bb
e4bc5fe
87624a1
2925639
412287e
1897dac
45d12e7
1d19fb2
9d1267d
c9c4d4c
ed4168d
16a9f51
915e6c3
641197e
18470bd
38d1d6c
cfbd436
397dcf1
938bdb0
c5da345
4e1ec2d
bd3f574
b703ee8
82339f9
fab1dc4
99165c9
9bd039d
6a3f637
4cfbc29
9a9a740
7cd685c
6f93632
642d8c0
e70609a
fdaa553
c293307
041459d
7aafaf6
1b6e585
20eacb0
81239d6
84dde8e
40a6201
07fbb91
35c16f1
038480a
d4f96cc
122727e
5b3518d
c8c2f84
2b119b0
1b3c076
e9e30a7
46ab295
01baee5
46903af
9b74c05
89e4532
3914949
d8126d1
87bab7b
02ea585
56fe4ca
722f05e
ae9eca4
f9dcc4f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve the readability I would explain that we mean the
kind=option
tokenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than quotes, which i find confusing, how about linking the term to the appropriate section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that works too.
I use the same syntax in the
kind
description to be homogeneousThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compact POJO description is a bit subtle to read. How about an expanded version with all the properties listed?
Proposed expanded
A returned token has two properties which are always defined,
and some other properties which vary depending on the
kind
:kind
{string} One of 'option', 'positional', or 'option-terminator'.index
{number} Index of element inargs
containing token. So thesource argument for a token is
args[token.index]
.An option token has additional parse details
for an option detected in the input
args
:kind
='option'
index
{number} Index of element inargs
containing token.name
{string} Long name of option.rawName
{string} How option used in args, like-f
of--foo
.value
{string | undefined} Option value specified in args.Undefined for boolean options.
inlineValue
{boolean | undefined} Whether option value specified inline,like
--foo=bar
.A positional token has just one additional property with the positional value:
kind
='positional'
index
{number} Index of element inargs
containing token.value
{string} The value of the positional argument in args (i.e.args[index]
).An option-terminator token has only the base properties:
kind
='option-terminator'
index
{number} Index of element inargs
containing token.Old compact
The returned tokens have properties describing:
kind
{string} One of 'option', 'positional', or 'option-terminator'.index
{number} Index of element inargs
containing token. So thesource argument for a token is
args[token.index]
.name
{string} Long name of option.rawName
{string} How option used in args, like-f
of--foo
.value
{string | undefined} Option value specified in args.Undefined for boolean options.
inlineValue
{boolean | undefined} Whether option value specified inline,like
--foo=bar
.value
{string} The value of the positional argument in args (i.e.args[index]
).(Also asked in: nodejs/node#43459 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.