{"action":"created","comment":{"url":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/comments/124839187","pull_request_review_id":47168356,"id":124839187,"diff_hunk":"@@ -0,0 +1,105 @@\n+use clap::{Arg, App};\n+\n+use std::env;\n+use std::net::Ipv4Addr;\n+use std::str::FromStr;\n+\n+const DEFAULT_GATEWAY: &str = \"192.168.42.1\";\n+const DEFAULT_DHCP_RANGE: &str = \"192.168.42.2,192.168.42.254\";\n+const DEFAULT_SSID: &str = \"ResinAP\";\n+\n+pub struct Config {\n+    pub interface: Option<String>,\n+    pub ssid: String,\n+    pub password: Option<String>,\n+    pub clear: bool,\n+    pub gateway: Ipv4Addr,\n+    pub dhcp_range: String,\n+}\n+\n+pub fn get_config() -> Config {\n+    let matches = App::new(env!(\"CARGO_PKG_NAME\"))\n+        .version(env!(\"CARGO_PKG_VERSION\"))\n+        .author(env!(\"CARGO_PKG_AUTHORS\"))\n+        .about(env!(\"CARGO_PKG_DESCRIPTION\"))\n+        .arg(\n+            Arg::with_name(\"interface\")\n+                .short(\"i\")\n+                .long(\"interface\")\n+                .value_name(\"INTERFACE\")\n+                .help(\"Hotspot interface\")\n+                .takes_value(true),\n+        )\n+        .arg(\n+            Arg::with_name(\"ssid\")\n+                .short(\"s\")\n+                .long(\"ssid\")\n+                .value_name(\"SSID\")\n+                .help(\"Hotspot SSID\")\n+                .takes_value(true),\n+        )\n+        .arg(\n+            Arg::with_name(\"password\")\n+                .short(\"p\")\n+                .long(\"password\")\n+                .value_name(\"PASSWORD\")\n+                .help(\"Hotspot password \")\n+                .takes_value(true),\n+        )\n+        .arg(\n+            Arg::with_name(\"clear\")\n+                .short(\"c\")\n+                .long(\"clear\")\n+                .value_name(\"CLEAR\")\n+                .help(\"Clear saved Wi-Fi credentials\")\n+                .takes_value(true),\n+        )\n+        .get_matches();\n+\n+    let interface: Option<String> = matches.value_of(\"interface\").map_or_else(\n+        || {\n+            env::var(\"PORTAL_INTERFACE\").ok()","path":"src/config.rs","position":61,"original_position":61,"commit_id":"1a3156984972cf2677e914ca99a0569b9723a839","original_commit_id":"1a3156984972cf2677e914ca99a0569b9723a839","user":{"login":"majorz","id":188837,"avatar_url":"https://avatars2.githubusercontent.com/u/188837?v=3","gravatar_id":"","url":"https://api.github.com/users/majorz","html_url":"https://github.com/majorz","followers_url":"https://api.github.com/users/majorz/followers","following_url":"https://api.github.com/users/majorz/following{/other_user}","gists_url":"https://api.github.com/users/majorz/gists{/gist_id}","starred_url":"https://api.github.com/users/majorz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/majorz/subscriptions","organizations_url":"https://api.github.com/users/majorz/orgs","repos_url":"https://api.github.com/users/majorz/repos","events_url":"https://api.github.com/users/majorz/events{/privacy}","received_events_url":"https://api.github.com/users/majorz/received_events","type":"User","site_admin":false},"body":"If no device is specified, we default to the first Wi-Fi device. Do we really need to default to 'wlan0'? For example on my laptop the internal one is called 'wlo1' and this one makes more sense as a default one for my system. Or I am missing something?","created_at":"2017-06-29T15:47:48Z","updated_at":"2017-06-29T15:47:48Z","html_url":"https://github.com/resin-io/resin-wifi-connect/pull/105#discussion_r124839187","pull_request_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/105","_links":{"self":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/comments/124839187"},"html":{"href":"https://github.com/resin-io/resin-wifi-connect/pull/105#discussion_r124839187"},"pull_request":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/105"}}},"pull_request":{"url":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/105","id":127925843,"html_url":"https://github.com/resin-io/resin-wifi-connect/pull/105","diff_url":"https://github.com/resin-io/resin-wifi-connect/pull/105.diff","patch_url":"https://github.com/resin-io/resin-wifi-connect/pull/105.patch","issue_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/105","number":105,"state":"open","locked":false,"title":"Rust language reimplementation","user":{"login":"majorz","id":188837,"avatar_url":"https://avatars2.githubusercontent.com/u/188837?v=3","gravatar_id":"","url":"https://api.github.com/users/majorz","html_url":"https://github.com/majorz","followers_url":"https://api.github.com/users/majorz/followers","following_url":"https://api.github.com/users/majorz/following{/other_user}","gists_url":"https://api.github.com/users/majorz/gists{/gist_id}","starred_url":"https://api.github.com/users/majorz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/majorz/subscriptions","organizations_url":"https://api.github.com/users/majorz/orgs","repos_url":"https://api.github.com/users/majorz/repos","events_url":"https://api.github.com/users/majorz/events{/privacy}","received_events_url":"https://api.github.com/users/majorz/received_events","type":"User","site_admin":false},"body":"Connects-To: #104\r\nChange-Type: minor\n---- Autogenerated Waffleboard Connection: Connects to #104","created_at":"2017-06-28T13:43:00Z","updated_at":"2017-06-29T15:47:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0010ba0949cd426292257957c452f7d346b68101","assignee":null,"assignees":[],"requested_reviewers":[{"login":"cmr","id":704250,"avatar_url":"https://avatars1.githubusercontent.com/u/704250?v=3","gravatar_id":"","url":"https://api.github.com/users/cmr","html_url":"https://github.com/cmr","followers_url":"https://api.github.com/users/cmr/followers","following_url":"https://api.github.com/users/cmr/following{/other_user}","gists_url":"https://api.github.com/users/cmr/gists{/gist_id}","starred_url":"https://api.github.com/users/cmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmr/subscriptions","organizations_url":"https://api.github.com/users/cmr/orgs","repos_url":"https://api.github.com/users/cmr/repos","events_url":"https://api.github.com/users/cmr/events{/privacy}","received_events_url":"https://api.github.com/users/cmr/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/105/commits","review_comments_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/105/comments","review_comment_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/comments{/number}","comments_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/105/comments","statuses_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/statuses/1a3156984972cf2677e914ca99a0569b9723a839","head":{"label":"resin-io:104-rust-binary","ref":"104-rust-binary","sha":"1a3156984972cf2677e914ca99a0569b9723a839","user":{"login":"resin-io","id":6157842,"avatar_url":"https://avatars2.githubusercontent.com/u/6157842?v=3","gravatar_id":"","url":"https://api.github.com/users/resin-io","html_url":"https://github.com/resin-io","followers_url":"https://api.github.com/users/resin-io/followers","following_url":"https://api.github.com/users/resin-io/following{/other_user}","gists_url":"https://api.github.com/users/resin-io/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io/subscriptions","organizations_url":"https://api.github.com/users/resin-io/orgs","repos_url":"https://api.github.com/users/resin-io/repos","events_url":"https://api.github.com/users/resin-io/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io/received_events","type":"Organization","site_admin":false},"repo":{"id":37727198,"name":"resin-wifi-connect","full_name":"resin-io/resin-wifi-connect","owner":{"login":"resin-io","id":6157842,"avatar_url":"https://avatars2.githubusercontent.com/u/6157842?v=3","gravatar_id":"","url":"https://api.github.com/users/resin-io","html_url":"https://github.com/resin-io","followers_url":"https://api.github.com/users/resin-io/followers","following_url":"https://api.github.com/users/resin-io/following{/other_user}","gists_url":"https://api.github.com/users/resin-io/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io/subscriptions","organizations_url":"https://api.github.com/users/resin-io/orgs","repos_url":"https://api.github.com/users/resin-io/repos","events_url":"https://api.github.com/users/resin-io/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/resin-io/resin-wifi-connect","description":"An app to allow WiFi configuration to be set via a captive portal.","fork":false,"url":"https://api.github.com/repos/resin-io/resin-wifi-connect","forks_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/forks","keys_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/teams","hooks_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/hooks","issue_events_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/events{/number}","events_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/events","assignees_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/assignees{/user}","branches_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/branches{/branch}","tags_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/tags","blobs_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/refs{/sha}","trees_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/statuses/{sha}","languages_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/languages","stargazers_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/stargazers","contributors_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/contributors","subscribers_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/subscribers","subscription_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/subscription","commits_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/commits{/sha}","git_commits_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/commits{/sha}","comments_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/comments{/number}","issue_comment_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/comments{/number}","contents_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/contents/{+path}","compare_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/merges","archive_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/downloads","issues_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues{/number}","pulls_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls{/number}","milestones_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/milestones{/number}","notifications_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/labels{/name}","releases_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/releases{/id}","deployments_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/deployments","created_at":"2015-06-19T14:45:09Z","updated_at":"2017-06-28T20:36:23Z","pushed_at":"2017-06-29T09:43:39Z","git_url":"git://github.com/resin-io/resin-wifi-connect.git","ssh_url":"git@github.com:resin-io/resin-wifi-connect.git","clone_url":"https://github.com/resin-io/resin-wifi-connect.git","svn_url":"https://github.com/resin-io/resin-wifi-connect","homepage":"","size":1307,"stargazers_count":73,"watchers_count":73,"language":"CoffeeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":16,"forks":38,"open_issues":16,"watchers":73,"default_branch":"master"}},"base":{"label":"resin-io:104-rust","ref":"104-rust","sha":"614e297c698a81bcf23f154cf9efd55fa838c325","user":{"login":"resin-io","id":6157842,"avatar_url":"https://avatars2.githubusercontent.com/u/6157842?v=3","gravatar_id":"","url":"https://api.github.com/users/resin-io","html_url":"https://github.com/resin-io","followers_url":"https://api.github.com/users/resin-io/followers","following_url":"https://api.github.com/users/resin-io/following{/other_user}","gists_url":"https://api.github.com/users/resin-io/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io/subscriptions","organizations_url":"https://api.github.com/users/resin-io/orgs","repos_url":"https://api.github.com/users/resin-io/repos","events_url":"https://api.github.com/users/resin-io/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io/received_events","type":"Organization","site_admin":false},"repo":{"id":37727198,"name":"resin-wifi-connect","full_name":"resin-io/resin-wifi-connect","owner":{"login":"resin-io","id":6157842,"avatar_url":"https://avatars2.githubusercontent.com/u/6157842?v=3","gravatar_id":"","url":"https://api.github.com/users/resin-io","html_url":"https://github.com/resin-io","followers_url":"https://api.github.com/users/resin-io/followers","following_url":"https://api.github.com/users/resin-io/following{/other_user}","gists_url":"https://api.github.com/users/resin-io/gists{/gist_id}","starred_url":"https://api.github.com/users/resin-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resin-io/subscriptions","organizations_url":"https://api.github.com/users/resin-io/orgs","repos_url":"https://api.github.com/users/resin-io/repos","events_url":"https://api.github.com/users/resin-io/events{/privacy}","received_events_url":"https://api.github.com/users/resin-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/resin-io/resin-wifi-connect","description":"An app to allow WiFi configuration to be set via a captive portal.","fork":false,"url":"https://api.github.com/repos/resin-io/resin-wifi-connect","forks_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/forks","keys_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/teams","hooks_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/hooks","issue_events_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/events{/number}","events_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/events","assignees_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/assignees{/user}","branches_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/branches{/branch}","tags_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/tags","blobs_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/refs{/sha}","trees_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/statuses/{sha}","languages_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/languages","stargazers_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/stargazers","contributors_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/contributors","subscribers_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/subscribers","subscription_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/subscription","commits_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/commits{/sha}","git_commits_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/git/commits{/sha}","comments_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/comments{/number}","issue_comment_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/comments{/number}","contents_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/contents/{+path}","compare_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/merges","archive_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/downloads","issues_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues{/number}","pulls_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls{/number}","milestones_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/milestones{/number}","notifications_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/labels{/name}","releases_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/releases{/id}","deployments_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/deployments","created_at":"2015-06-19T14:45:09Z","updated_at":"2017-06-28T20:36:23Z","pushed_at":"2017-06-29T09:43:39Z","git_url":"git://github.com/resin-io/resin-wifi-connect.git","ssh_url":"git@github.com:resin-io/resin-wifi-connect.git","clone_url":"https://github.com/resin-io/resin-wifi-connect.git","svn_url":"https://github.com/resin-io/resin-wifi-connect","homepage":"","size":1307,"stargazers_count":73,"watchers_count":73,"language":"CoffeeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":16,"forks":38,"open_issues":16,"watchers":73,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/105"},"html":{"href":"https://github.com/resin-io/resin-wifi-connect/pull/105"},"issue":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/105"},"comments":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/resin-io/resin-wifi-connect/statuses/1a3156984972cf2677e914ca99a0569b9723a839"}}}}
{"actor":{"display_login":"majorz"}}