Committing not to ever use a description
field / maybe reserving some other fields for future use
#86
Labels
description
field / maybe reserving some other fields for future use
#86
Right now,
parseArgs
is not going to generate usage text for you. I think that's sensible. But it's an obvious thing to want, so I imagine someone's going to make a library which takes theoptions
specification and generates help text. The way I imagine that working is that it would take exactly the sameoptions
config, but each option would additionally have adescription
field, and possibly others. That is:The thing to note here is that I expect such usage-generating libraries to be passed the same object as
parseArgs
, because that's by far the most convenient thing for script authors. But it would (in my imagining) also look at some additional keys currently ignored byparseArgs
, at the very leastdescription
.If and when such libraries exist and are in common use, that means
parseArgs
is never going to be able to use any such additional keys for its own purposes - that would be a breaking change, because the script author did not intendparseArgs
to read thedescriptions
. A particularly cautious library author might want to refrain from using extra fields for that reason, though I am sure not everyone will be that cautious, so such libraries will almost certainly exist regardless.As such, I think it makes sense to decide now if there are any fields like this which
parseArgs
wants to commit to not using, so that such userland libraries can use those fields without worrying about that breakingparseArgs
later.And, conversely, if there are fields (possibly
default
?) whichparseArgs
might want to make use of later, but which a library built on top ofparseArgs
might start using for their own purposes, it might make sense to reserve those fields somehow - either just in the description ofparseArgs
, or (more aggressively) by actively throwing if those fields exist.The text was updated successfully, but these errors were encountered: