{"action":"created","issue":{"url":"https://api.github.com/repos/kbknapp/clap-rs/issues/277","labels_url":"https://api.github.com/repos/kbknapp/clap-rs/issues/277/labels{/name}","comments_url":"https://api.github.com/repos/kbknapp/clap-rs/issues/277/comments","events_url":"https://api.github.com/repos/kbknapp/clap-rs/issues/277/events","html_url":"https://github.com/kbknapp/clap-rs/issues/277","id":108163063,"number":277,"title":"Unexpected elements in usage","user":{"login":"elszben","id":4603999,"avatar_url":"https://avatars.githubusercontent.com/u/4603999?v=3","gravatar_id":"","url":"https://api.github.com/users/elszben","html_url":"https://github.com/elszben","followers_url":"https://api.github.com/users/elszben/followers","following_url":"https://api.github.com/users/elszben/following{/other_user}","gists_url":"https://api.github.com/users/elszben/gists{/gist_id}","starred_url":"https://api.github.com/users/elszben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elszben/subscriptions","organizations_url":"https://api.github.com/users/elszben/orgs","repos_url":"https://api.github.com/users/elszben/repos","events_url":"https://api.github.com/users/elszben/events{/privacy}","received_events_url":"https://api.github.com/users/elszben/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-24T16:11:55Z","updated_at":"2015-09-24T16:24:55Z","closed_at":null,"body":"    extern crate clap;\r\n\r\n    use clap::{Arg,App};\r\n\r\n    fn main() {\r\n        println!(\"Hello, world!\");\r\n      \r\n        App::new(\"alma\"\r\n       ).arg(\r\n       Arg::with_name(\"arg1\").short(\"c\").takes_value(true).help(\"stuff\").required(true)\r\n       ).arg(\r\n       Arg::with_name(\"arg2\").short(\"d\").takes_value(true).help(\"stuff\").required(true)\r\n       ).arg(\r\n       Arg::with_name(\"arg3\").short(\"e\").takes_value(true).help(\"stuff\").required(true)\r\n       ).arg(\r\n      Arg::with_name(\"arg4\").short(\"f\").takes_value(true).help(\"stuff\").required(true)\r\n      ).get_matches();\r\n    }\r\n\r\nThis program with arguments  -c gd -d fdf generates a really weird, unexpected error message:\r\n\r\n     Hello, world!\r\n     error: The following required arguments were not supplied:\r\n            '-c <arg1>'\r\n            '-d <arg2>'\r\n            '-e <arg3>'\r\n            '-f <arg4>'\r\n \r\n     USAGE:\r\n            claptest -c <arg1> -d <arg2> -e <arg3> -f <arg4> -d <arg2> -c <arg1>\r\n\r\n     For more information try --help\r\n\r\nThe argument c and d were supplied but the program lists them as not supplied. I think this is plain wrong but I don't know what the design was, let's say that this is working as intended.\r\nHowever the USAGE text lists -c and -d twice and I can't come up with a situation where this is actually useful or makes sense.\r\n\r\nI've tried to figure out why the second fault happens and added some debug code into clap. It seems that create_usage() creates a list of args from known required args and it just appends the current matches to the list but does not remove duplicates. No idea how to fix this elegantly while also keeping the order (is that even necessary?). This context specific usage generation seems weird to me:) The library is quite nice otherwise.\r\n"},"comment":{"url":"https://api.github.com/repos/kbknapp/clap-rs/issues/comments/142978772","html_url":"https://github.com/kbknapp/clap-rs/issues/277#issuecomment-142978772","issue_url":"https://api.github.com/repos/kbknapp/clap-rs/issues/277","id":142978772,"user":{"login":"james-darkfox","id":637155,"avatar_url":"https://avatars.githubusercontent.com/u/637155?v=3","gravatar_id":"","url":"https://api.github.com/users/james-darkfox","html_url":"https://github.com/james-darkfox","followers_url":"https://api.github.com/users/james-darkfox/followers","following_url":"https://api.github.com/users/james-darkfox/following{/other_user}","gists_url":"https://api.github.com/users/james-darkfox/gists{/gist_id}","starred_url":"https://api.github.com/users/james-darkfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/james-darkfox/subscriptions","organizations_url":"https://api.github.com/users/james-darkfox/orgs","repos_url":"https://api.github.com/users/james-darkfox/repos","events_url":"https://api.github.com/users/james-darkfox/events{/privacy}","received_events_url":"https://api.github.com/users/james-darkfox/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T16:24:55Z","updated_at":"2015-09-24T16:24:55Z","body":"@elszben What do you get when you give it each argument exactly once? Does it run as expected?"}}