{"action":"created","issue":{"url":"https://api.github.com/repos/kbknapp/clap-rs/issues/103","labels_url":"https://api.github.com/repos/kbknapp/clap-rs/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/kbknapp/clap-rs/issues/103/comments","events_url":"https://api.github.com/repos/kbknapp/clap-rs/issues/103/events","html_url":"https://github.com/kbknapp/clap-rs/pull/103","id":73248222,"number":103,"title":"WIP: `did-you-mean` for clap-rs [DO NOT MERGE]","user":{"login":"Byron","id":63622,"avatar_url":"https://avatars.githubusercontent.com/u/63622?v=3","gravatar_id":"","url":"https://api.github.com/users/Byron","html_url":"https://github.com/Byron","followers_url":"https://api.github.com/users/Byron/followers","following_url":"https://api.github.com/users/Byron/following{/other_user}","gists_url":"https://api.github.com/users/Byron/gists{/gist_id}","starred_url":"https://api.github.com/users/Byron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Byron/subscriptions","organizations_url":"https://api.github.com/users/Byron/orgs","repos_url":"https://api.github.com/users/Byron/repos","events_url":"https://api.github.com/users/Byron/events{/privacy}","received_events_url":"https://api.github.com/users/Byron/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-05T08:34:50Z","updated_at":"2015-05-05T13:14:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kbknapp/clap-rs/pulls/103","html_url":"https://github.com/kbknapp/clap-rs/pull/103","diff_url":"https://github.com/kbknapp/clap-rs/pull/103.diff","patch_url":"https://github.com/kbknapp/clap-rs/pull/103.patch"},"body":"Now that *did you mean* was implemented for the parts under control of `google-apis-rs`, for completeness it should also be available for clap-rs. As done in `google-apis-rs`, suggestions should only be made above a certain confidence level, e.g. `foo` will not result in `did you mean 'baz'`.\r\n\r\nThis improvement involves the following parts:\r\n\r\n* [x] sub-command names\r\n    - `prog foo` results in `foo is not a valid subcommand. Did you mean 'fop'?`.\r\n* [x]  long flags and options\r\n   - `prog --heln` results in `--heln is not a valid option. Did you mean '--help'?`\r\n   - `prog --debug-leve=1` results in `--debug-leve is not a valid option. Did you mean '--debug-level' ?`\r\n   - Why not for short flags ? I think the input string should be more than one character to get a useful result.\r\n   - *NOTE*: We do not provide the given arguments (i.e. `--debug-level=1`) in our suggestion as this is also currently not the case with the standard messages in that area. It might be worth a separate issue.\r\n* [ ] possible values\r\n   - `prog --mode=foz` results in `'foz' is not a valid mode. Please choose one of 'foo' and 'baz'. Did you mean '--mode=foo' ?`\r\n   - It only works for one item at a time.. Thus `prog --modi=foz` results in `--modi is not a valid option. Did you mean '--mode=foz'`. Thus it is not required to detect that the suggested flag has *possible values*, which allows this implementation to remain simple and 'stupid' in its first iteration.\r\n\r\nIf the required confidence level is not reached, the output of the usage string will remain exactly as it was before.\r\n\r\n## Feedback-dependant Goals\r\n\r\n* [ ] put this feature around a cargo feature-gate."},"comment":{"url":"https://api.github.com/repos/kbknapp/clap-rs/issues/comments/99074876","html_url":"https://github.com/kbknapp/clap-rs/pull/103#issuecomment-99074876","issue_url":"https://api.github.com/repos/kbknapp/clap-rs/issues/103","id":99074876,"user":{"login":"kbknapp","id":6942134,"avatar_url":"https://avatars.githubusercontent.com/u/6942134?v=3","gravatar_id":"","url":"https://api.github.com/users/kbknapp","html_url":"https://github.com/kbknapp","followers_url":"https://api.github.com/users/kbknapp/followers","following_url":"https://api.github.com/users/kbknapp/following{/other_user}","gists_url":"https://api.github.com/users/kbknapp/gists{/gist_id}","starred_url":"https://api.github.com/users/kbknapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbknapp/subscriptions","organizations_url":"https://api.github.com/users/kbknapp/orgs","repos_url":"https://api.github.com/users/kbknapp/repos","events_url":"https://api.github.com/users/kbknapp/events{/privacy}","received_events_url":"https://api.github.com/users/kbknapp/received_events","type":"User","site_admin":false},"created_at":"2015-05-05T13:14:51Z","updated_at":"2015-05-05T13:14:51Z","body":"I think in this instance the code is small enough that we *could* simply just copy/paste, but I'd prefer to use the dependency and a cargo feature as I think this gives better credit, allows one to disable the feature if desired, and also allows for upstream improvements. We could end up copying the code at a later point if it ends up diverging from what we need, also."}}