{"action":"created","comment":{"url":"https://api.github.com/repos/sharkdp/fd/pulls/comments/143208597","pull_request_review_id":67688104,"id":143208597,"diff_hunk":"@@ -1,110 +1,148 @@\n+use std::collections::HashMap;\n+\n use clap::{App, AppSettings, Arg};\n \n+struct Help {\n+    short: &'static str,\n+    long: &'static str,\n+}\n+\n+macro_rules! doc {\n+    ($map:expr, $name:expr, $short:expr) => {\n+        doc!($map, $name, $short, $short)\n+    };\n+    ($map:expr, $name:expr, $short:expr, $long:expr) => {\n+        $map.insert($name, Help {\n+            short: $short,\n+            long: concat!($long, \"\\n \")\n+        });\n+    };\n+}\n+\n pub fn build_app() -> App<'static, 'static> {\n+    let helps = usage();\n+    let arg = |name| {\n+        Arg::with_name(name).help(helps[name].short).long_help(\n+            helps[name].long,\n+        )\n+    };\n+\n     App::new(\"fd\")\n         .version(crate_version!())\n         .usage(\"fd [FLAGS/OPTIONS] [<pattern>] [<path>]\")\n         .setting(AppSettings::ColoredHelp)\n         .setting(AppSettings::DeriveDisplayOrder)\n+        .arg(arg(\"hidden\").long(\"hidden\").short(\"H\"))\n+        .arg(arg(\"no-ignore\").long(\"no-ignore\").short(\"I\"))\n+        .arg(arg(\"case-sensitive\").long(\"case-sensitive\").short(\"s\"))\n+        .arg(arg(\"absolute-path\").long(\"absolute-path\").short(\"a\"))\n+        .arg(arg(\"follow\").long(\"follow\").short(\"L\").alias(\"dereference\"))\n+        .arg(arg(\"full-path\").long(\"full-path\").short(\"p\"))\n+        .arg(arg(\"null_separator\").long(\"print0\").short(\"0\"))\n+        .arg(arg(\"depth\").long(\"max-depth\").short(\"d\").takes_value(true))\n         .arg(\n-            Arg::with_name(\"hidden\")\n-                .long(\"hidden\")\n-                .short(\"H\")\n-                .help(\"Search hidden files and directories\"),\n-        )\n-        .arg(\n-            Arg::with_name(\"no-ignore\")\n-                .long(\"no-ignore\")\n-                .short(\"I\")\n-                .help(\"Do not respect .(git)ignore files\"),\n-        )\n-        .arg(\n-            Arg::with_name(\"case-sensitive\")\n-                .long(\"case-sensitive\")\n-                .short(\"s\")\n-                .help(\"Case-sensitive search (default: smart case)\"),\n-        )\n-        .arg(\n-            Arg::with_name(\"absolute-path\")\n-                .long(\"absolute-path\")\n-                .short(\"a\")\n-                .help(\"Show absolute instead of relative paths\"),\n-        )\n-        .arg(\n-            Arg::with_name(\"follow\")\n-                .long(\"follow\")\n-                .short(\"L\")\n-                .alias(\"dereference\")\n-                .help(\"Follow symbolic links\"),\n-        )\n-        .arg(\n-            Arg::with_name(\"full-path\")\n-                .long(\"full-path\")\n-                .short(\"p\")\n-                .help(\"Search full path (default: file-/dirname only)\"),\n-        )\n-        .arg(\n-            Arg::with_name(\"null_separator\")\n-                .long(\"print0\")\n-                .short(\"0\")\n-                .help(\"Separate results by the null character\"),\n-        )\n-        .arg(\n-            Arg::with_name(\"depth\")\n-                .long(\"max-depth\")\n-                .short(\"d\")\n-                .takes_value(true)\n-                .help(\"Set maximum search depth (default: none)\"),\n-        )\n-        .arg(\n-            Arg::with_name(\"file-type\")\n+            arg(\"file-type\")\n                 .long(\"type\")\n                 .short(\"t\")\n                 .takes_value(true)\n                 .value_name(\"filetype\")\n                 .possible_values(&[\"f\", \"file\", \"d\", \"directory\", \"s\", \"symlink\"])\n-                .hide_possible_values(true)\n-                .help(\"Filter by type: f(ile), d(irectory), s(ymlink)\"),\n+                .hide_possible_values(true),\n         )\n         .arg(\n-            Arg::with_name(\"extension\")\n+            arg(\"extension\")\n                 .long(\"extension\")\n                 .short(\"e\")\n                 .takes_value(true)\n-                .value_name(\"ext\")\n-                .help(\"Filter by file extension\"),\n+                .value_name(\"ext\"),\n         )\n         .arg(\n-            Arg::with_name(\"color\")\n+            arg(\"color\")\n                 .long(\"color\")\n                 .short(\"c\")\n                 .takes_value(true)\n                 .value_name(\"when\")\n                 .possible_values(&[\"never\", \"auto\", \"always\"])\n-                .hide_possible_values(true)\n-                .help(\n-                    \"When to use color in the output:\\n\\\n-                     never, auto, always (default: auto)\",\n-                ),\n+                .hide_possible_values(true),\n         )\n         .arg(\n-            Arg::with_name(\"threads\")\n+            arg(\"threads\")\n                 .long(\"threads\")\n                 .short(\"j\")\n                 .takes_value(true)\n-                .value_name(\"num\")\n-                .help(\n-                    \"Set number of threads to use for searching\\n\\\n-                     (default: number of available CPU cores)\",\n-                ),\n+                .value_name(\"num\"),\n         )\n         .arg(\n-            Arg::with_name(\"max-buffer-time\")\n+            arg(\"max-buffer-time\")\n                 .long(\"max-buffer-time\")\n                 .takes_value(true)\n-                .hidden(true)\n-                .help(\"the time (in ms) to buffer, before streaming to the console\"),\n+                .hidden(true),\n         )\n-        .arg(Arg::with_name(\"pattern\").help(\"the search pattern, a regular expression (optional)\"))\n-        .arg(Arg::with_name(\"path\").help(\"the root directory for the filesystem search (optional)\"))\n+        .arg(arg(\"pattern\"))\n+        .arg(arg(\"path\"))\n+}\n+\n+#[cfg_attr(rustfmt, rustfmt_skip)]\n+fn usage() -> HashMap<&'static str, Help> {\n+    let mut h = HashMap::new();\n+    doc!(h, \"hidden\"\n+        , \"Search hidden files and directories\"\n+        , \"Includes, in a search query, any hidden files and directories for the directory of \\\n+            the search.\");\n+    doc!(h, \"no-ignore\"\n+        , \"Do not respect .(git)ignore files\"\n+        , \"Searches for a pattern match with files and directories, including all defined \\\n+            `.*ignore` file exceptions. Useful when you want to match inclusively for a pattern.\");\n+    doc!(h, \"case-sensitive\"\n+        , \"Case-sensitive search (default: smart case)\"\n+        , \"Define your pattern as case sensitive. By default, fd uses 'smart case' for queries.\\\n+            This option disables smart case.\");\n+    doc!(h, \"absolute-path\"\n+        , \"Show absolute instead of relative paths\"\n+        , \"Shows the result of a pattern match as an absolute path instead of relative path.\");\n+    doc!(h, \"follow\"\n+        , \"Follow symbolic links\"\n+        , \"Includes a symbolic links destination in the pattern match.\");\n+    doc!(h, \"full-path\"\n+        , \"Search full path (default: file-/dirname only)\"\n+        , \"Searches the full path of directory. By default, fd only navigates file-/dirname.\");","path":"src/app.rs","position":181,"original_position":181,"commit_id":"276d8813b9d2897b0bb3c09631e32055399ad963","original_commit_id":"276d8813b9d2897b0bb3c09631e32055399ad963","user":{"login":"sharkdp","id":4209276,"avatar_url":"https://avatars2.githubusercontent.com/u/4209276?v=4","gravatar_id":"","url":"https://api.github.com/users/sharkdp","html_url":"https://github.com/sharkdp","followers_url":"https://api.github.com/users/sharkdp/followers","following_url":"https://api.github.com/users/sharkdp/following{/other_user}","gists_url":"https://api.github.com/users/sharkdp/gists{/gist_id}","starred_url":"https://api.github.com/users/sharkdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharkdp/subscriptions","organizations_url":"https://api.github.com/users/sharkdp/orgs","repos_url":"https://api.github.com/users/sharkdp/repos","events_url":"https://api.github.com/users/sharkdp/events{/privacy}","received_events_url":"https://api.github.com/users/sharkdp/received_events","type":"User","site_admin":false},"body":"It's rather: \"[..] By default, fd only searches the last part of the path (the file name or the directory name)\"","created_at":"2017-10-06T14:44:26Z","updated_at":"2017-10-06T14:50:54Z","html_url":"https://github.com/sharkdp/fd/pull/71#discussion_r143208597","pull_request_url":"https://api.github.com/repos/sharkdp/fd/pulls/71","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/sharkdp/fd/pulls/comments/143208597"},"html":{"href":"https://github.com/sharkdp/fd/pull/71#discussion_r143208597"},"pull_request":{"href":"https://api.github.com/repos/sharkdp/fd/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/sharkdp/fd/pulls/71","id":144822038,"html_url":"https://github.com/sharkdp/fd/pull/71","diff_url":"https://github.com/sharkdp/fd/pull/71.diff","patch_url":"https://github.com/sharkdp/fd/pull/71.patch","issue_url":"https://api.github.com/repos/sharkdp/fd/issues/71","number":71,"state":"open","locked":false,"title":"initial addition of long_help","user":{"login":"abaez","id":1403630,"avatar_url":"https://avatars2.githubusercontent.com/u/1403630?v=4","gravatar_id":"","url":"https://api.github.com/users/abaez","html_url":"https://github.com/abaez","followers_url":"https://api.github.com/users/abaez/followers","following_url":"https://api.github.com/users/abaez/following{/other_user}","gists_url":"https://api.github.com/users/abaez/gists{/gist_id}","starred_url":"https://api.github.com/users/abaez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abaez/subscriptions","organizations_url":"https://api.github.com/users/abaez/orgs","repos_url":"https://api.github.com/users/abaez/repos","events_url":"https://api.github.com/users/abaez/events{/privacy}","received_events_url":"https://api.github.com/users/abaez/received_events","type":"User","site_admin":false},"body":"As requested for #63, here's the initial portion of [long_help][1] for the `--help` flag.\r\n\r\nI've only done the first three, since I want to know what you think of the formatting before I continue doing all the rest. I tend to split up clap's expansion help to their own variable for easier readability in argument definitions. \r\n\r\n[1]: https://docs.rs/clap/2.26.2/clap/struct.Arg.html#method.long_help","created_at":"2017-10-05T03:30:04Z","updated_at":"2017-10-06T14:50:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"63a86f2491b4138cab58dfd4776d3ed0c4d38c39","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/sharkdp/fd/pulls/71/commits","review_comments_url":"https://api.github.com/repos/sharkdp/fd/pulls/71/comments","review_comment_url":"https://api.github.com/repos/sharkdp/fd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sharkdp/fd/issues/71/comments","statuses_url":"https://api.github.com/repos/sharkdp/fd/statuses/276d8813b9d2897b0bb3c09631e32055399ad963","head":{"label":"abaez:long_help","ref":"long_help","sha":"276d8813b9d2897b0bb3c09631e32055399ad963","user":{"login":"abaez","id":1403630,"avatar_url":"https://avatars2.githubusercontent.com/u/1403630?v=4","gravatar_id":"","url":"https://api.github.com/users/abaez","html_url":"https://github.com/abaez","followers_url":"https://api.github.com/users/abaez/followers","following_url":"https://api.github.com/users/abaez/following{/other_user}","gists_url":"https://api.github.com/users/abaez/gists{/gist_id}","starred_url":"https://api.github.com/users/abaez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abaez/subscriptions","organizations_url":"https://api.github.com/users/abaez/orgs","repos_url":"https://api.github.com/users/abaez/repos","events_url":"https://api.github.com/users/abaez/events{/privacy}","received_events_url":"https://api.github.com/users/abaez/received_events","type":"User","site_admin":false},"repo":{"id":105844574,"name":"fd","full_name":"abaez/fd","owner":{"login":"abaez","id":1403630,"avatar_url":"https://avatars2.githubusercontent.com/u/1403630?v=4","gravatar_id":"","url":"https://api.github.com/users/abaez","html_url":"https://github.com/abaez","followers_url":"https://api.github.com/users/abaez/followers","following_url":"https://api.github.com/users/abaez/following{/other_user}","gists_url":"https://api.github.com/users/abaez/gists{/gist_id}","starred_url":"https://api.github.com/users/abaez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abaez/subscriptions","organizations_url":"https://api.github.com/users/abaez/orgs","repos_url":"https://api.github.com/users/abaez/repos","events_url":"https://api.github.com/users/abaez/events{/privacy}","received_events_url":"https://api.github.com/users/abaez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abaez/fd","description":"A simple, fast and user-friendly alternative to find.","fork":true,"url":"https://api.github.com/repos/abaez/fd","forks_url":"https://api.github.com/repos/abaez/fd/forks","keys_url":"https://api.github.com/repos/abaez/fd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abaez/fd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abaez/fd/teams","hooks_url":"https://api.github.com/repos/abaez/fd/hooks","issue_events_url":"https://api.github.com/repos/abaez/fd/issues/events{/number}","events_url":"https://api.github.com/repos/abaez/fd/events","assignees_url":"https://api.github.com/repos/abaez/fd/assignees{/user}","branches_url":"https://api.github.com/repos/abaez/fd/branches{/branch}","tags_url":"https://api.github.com/repos/abaez/fd/tags","blobs_url":"https://api.github.com/repos/abaez/fd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abaez/fd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abaez/fd/git/refs{/sha}","trees_url":"https://api.github.com/repos/abaez/fd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abaez/fd/statuses/{sha}","languages_url":"https://api.github.com/repos/abaez/fd/languages","stargazers_url":"https://api.github.com/repos/abaez/fd/stargazers","contributors_url":"https://api.github.com/repos/abaez/fd/contributors","subscribers_url":"https://api.github.com/repos/abaez/fd/subscribers","subscription_url":"https://api.github.com/repos/abaez/fd/subscription","commits_url":"https://api.github.com/repos/abaez/fd/commits{/sha}","git_commits_url":"https://api.github.com/repos/abaez/fd/git/commits{/sha}","comments_url":"https://api.github.com/repos/abaez/fd/comments{/number}","issue_comment_url":"https://api.github.com/repos/abaez/fd/issues/comments{/number}","contents_url":"https://api.github.com/repos/abaez/fd/contents/{+path}","compare_url":"https://api.github.com/repos/abaez/fd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abaez/fd/merges","archive_url":"https://api.github.com/repos/abaez/fd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abaez/fd/downloads","issues_url":"https://api.github.com/repos/abaez/fd/issues{/number}","pulls_url":"https://api.github.com/repos/abaez/fd/pulls{/number}","milestones_url":"https://api.github.com/repos/abaez/fd/milestones{/number}","notifications_url":"https://api.github.com/repos/abaez/fd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abaez/fd/labels{/name}","releases_url":"https://api.github.com/repos/abaez/fd/releases{/id}","deployments_url":"https://api.github.com/repos/abaez/fd/deployments","created_at":"2017-10-05T03:14:52Z","updated_at":"2017-10-05T03:14:54Z","pushed_at":"2017-10-05T20:24:26Z","git_url":"git://github.com/abaez/fd.git","ssh_url":"git@github.com:abaez/fd.git","clone_url":"https://github.com/abaez/fd.git","svn_url":"https://github.com/abaez/fd","homepage":"","size":113,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sharkdp:master","ref":"master","sha":"0aae4a3d469d7902c0afb22a27d98186c9ec627a","user":{"login":"sharkdp","id":4209276,"avatar_url":"https://avatars2.githubusercontent.com/u/4209276?v=4","gravatar_id":"","url":"https://api.github.com/users/sharkdp","html_url":"https://github.com/sharkdp","followers_url":"https://api.github.com/users/sharkdp/followers","following_url":"https://api.github.com/users/sharkdp/following{/other_user}","gists_url":"https://api.github.com/users/sharkdp/gists{/gist_id}","starred_url":"https://api.github.com/users/sharkdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharkdp/subscriptions","organizations_url":"https://api.github.com/users/sharkdp/orgs","repos_url":"https://api.github.com/users/sharkdp/repos","events_url":"https://api.github.com/users/sharkdp/events{/privacy}","received_events_url":"https://api.github.com/users/sharkdp/received_events","type":"User","site_admin":false},"repo":{"id":90793418,"name":"fd","full_name":"sharkdp/fd","owner":{"login":"sharkdp","id":4209276,"avatar_url":"https://avatars2.githubusercontent.com/u/4209276?v=4","gravatar_id":"","url":"https://api.github.com/users/sharkdp","html_url":"https://github.com/sharkdp","followers_url":"https://api.github.com/users/sharkdp/followers","following_url":"https://api.github.com/users/sharkdp/following{/other_user}","gists_url":"https://api.github.com/users/sharkdp/gists{/gist_id}","starred_url":"https://api.github.com/users/sharkdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharkdp/subscriptions","organizations_url":"https://api.github.com/users/sharkdp/orgs","repos_url":"https://api.github.com/users/sharkdp/repos","events_url":"https://api.github.com/users/sharkdp/events{/privacy}","received_events_url":"https://api.github.com/users/sharkdp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sharkdp/fd","description":"A simple, fast and user-friendly alternative to find.","fork":false,"url":"https://api.github.com/repos/sharkdp/fd","forks_url":"https://api.github.com/repos/sharkdp/fd/forks","keys_url":"https://api.github.com/repos/sharkdp/fd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sharkdp/fd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sharkdp/fd/teams","hooks_url":"https://api.github.com/repos/sharkdp/fd/hooks","issue_events_url":"https://api.github.com/repos/sharkdp/fd/issues/events{/number}","events_url":"https://api.github.com/repos/sharkdp/fd/events","assignees_url":"https://api.github.com/repos/sharkdp/fd/assignees{/user}","branches_url":"https://api.github.com/repos/sharkdp/fd/branches{/branch}","tags_url":"https://api.github.com/repos/sharkdp/fd/tags","blobs_url":"https://api.github.com/repos/sharkdp/fd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sharkdp/fd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sharkdp/fd/git/refs{/sha}","trees_url":"https://api.github.com/repos/sharkdp/fd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sharkdp/fd/statuses/{sha}","languages_url":"https://api.github.com/repos/sharkdp/fd/languages","stargazers_url":"https://api.github.com/repos/sharkdp/fd/stargazers","contributors_url":"https://api.github.com/repos/sharkdp/fd/contributors","subscribers_url":"https://api.github.com/repos/sharkdp/fd/subscribers","subscription_url":"https://api.github.com/repos/sharkdp/fd/subscription","commits_url":"https://api.github.com/repos/sharkdp/fd/commits{/sha}","git_commits_url":"https://api.github.com/repos/sharkdp/fd/git/commits{/sha}","comments_url":"https://api.github.com/repos/sharkdp/fd/comments{/number}","issue_comment_url":"https://api.github.com/repos/sharkdp/fd/issues/comments{/number}","contents_url":"https://api.github.com/repos/sharkdp/fd/contents/{+path}","compare_url":"https://api.github.com/repos/sharkdp/fd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sharkdp/fd/merges","archive_url":"https://api.github.com/repos/sharkdp/fd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sharkdp/fd/downloads","issues_url":"https://api.github.com/repos/sharkdp/fd/issues{/number}","pulls_url":"https://api.github.com/repos/sharkdp/fd/pulls{/number}","milestones_url":"https://api.github.com/repos/sharkdp/fd/milestones{/number}","notifications_url":"https://api.github.com/repos/sharkdp/fd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sharkdp/fd/labels{/name}","releases_url":"https://api.github.com/repos/sharkdp/fd/releases{/id}","deployments_url":"https://api.github.com/repos/sharkdp/fd/deployments","created_at":"2017-05-09T21:27:10Z","updated_at":"2017-10-06T11:53:16Z","pushed_at":"2017-10-06T14:31:05Z","git_url":"git://github.com/sharkdp/fd.git","ssh_url":"git@github.com:sharkdp/fd.git","clone_url":"https://github.com/sharkdp/fd.git","svn_url":"https://github.com/sharkdp/fd","homepage":"","size":108,"stargazers_count":497,"watchers_count":497,"language":"Rust","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":9,"forks":21,"open_issues":9,"watchers":497,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sharkdp/fd/pulls/71"},"html":{"href":"https://github.com/sharkdp/fd/pull/71"},"issue":{"href":"https://api.github.com/repos/sharkdp/fd/issues/71"},"comments":{"href":"https://api.github.com/repos/sharkdp/fd/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/sharkdp/fd/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/sharkdp/fd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sharkdp/fd/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/sharkdp/fd/statuses/276d8813b9d2897b0bb3c09631e32055399ad963"}},"author_association":"NONE"}}
{"actor":{"display_login":"sharkdp"}}