-
Notifications
You must be signed in to change notification settings - Fork 0
Provide data in the application domain rather than the CLI domain #196
Comments
Comment by epage Sounds like this is related to clap-rs/clap#2832 |
Comment by epage @pksunkara just captured in the Issue my thoughts from not being able to sleep last night :) I'm sure you also have some and would love to hear and see how we can synthesize the two. The only linked issue I'm seeing this directly help with is #2206. I thought it would help with #2505 but it sounds like we just repeat the same problem after exploring the idea. |
Comment by pksunkara Looks good to me. I would actually make this the main product objective for 4.0. I will add more if needed once I get into this context later (which I still have in my todo) |
Comment by epage From clap-rs/clap#2832
|
Comment by epage
With the proposed API, if you want a path, you'd be specifying it as a |
Comment by ssokolow Ahh. By "if not handled carefully", I meant "this could turn into a footgun for end users if clap doesn't handle it carefully", and that should fit the definition of "clap handling it carefully" well enough. |
Issue by pksunkara
Friday Aug 13, 2021 at 01:05 GMT
Originally opened as clap-rs/clap#2683
Currently, clap's API is focused on the CLI domain, with data being tracked as
OsString
with specialized helpers forString
. At the tale-end of the builder API, we provide thevalue_of_t
API. We do gloss over this in the derive API.Problems with the current approach
ArgMatches
to handle every case_os
functions but disallow non-UTF8 during validation (fix: Provide path to avoid UTF-8 panics clap-rs/clap#2677)See also clap-rs/clap#2832
Roll out
ArgMatches
to storeBox<Any + Send + Sync + 'static>
OsString
toString
, deprecatingAllowInvalidUtf8
, gated behind a feature flagOther considerations / open questions
multiple_values
, users also have to setdefault_values
,value_names
, andvalue_hints
, should we followpossible_values
and avoid users passing in parallel arrays?Display
clap_derive
currently punts on this by providing both adefault_value
anddefault_value_t
where the latter has to supportDisplay
and it gets forwarded todefault_value
, see feat(derive): Specify defaults by native expressions clap-rs/clap#2635AllowInvalidUtf8
Any
, etc.trait ValueParser
and provide astruct BoxedValueParser
that contains an enum for common function-pointer signatures (wrapped with converters for the error types) and people can explicitly construct aBoxedValueParser
for their custom typeclap_derive
ArgMatches
API to be more map-likeremove
function would allowclap_derive
to move values, instead of clone them.default_value
:ValueHint
: if we can detect and set a default forPath
that would provide a better default experiencevalue_name
for named arguments: the default (of--name <name>
) is redundant. If we could provide type related defaults (e.g.PATH
forPathBuf
,NUM
for numbers), it would also provide a better default experienceOriginal
Basically, there are two things that need to be solved here.
I have to dig into the code to write a longer description of issues with the current behaviour and design.
See also clap-rs/clap#2832
The text was updated successfully, but these errors were encountered: