{"action":"created","comment":{"url":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/comments/29712975","id":29712975,"diff_hunk":"@@ -124,4 +151,56 @@ class Conjur::Command::Variables < Conjur::Command\n     end\n \n   end\n+\n+  def self.prompt_for_id\n+    highline.ask('Enter the id: ')\n+  end\n+\n+  def self.prompt_for_group\n+    highline.ask('Enter the group: ', ->(name) { @group && @group.roleid } ) do |q|\n+      q.validate = ->(name) do\n+        name.empty? || (@group = api.group(name)).exists?\n+      end\n+      q.responses[:not_valid] = \"Group '<%= @answer %>' doesn't exist, or you don't have permission to use it\"\n+    end\n+  end\n+\n+  def self.prompt_for_kind\n+    highline.ask('Enter the kind: ') {|q| q.default = @default_kind }\n+  end\n+\n+  def self.prompt_for_mime_type\n+    highline.ask('Enter the MIME type: ') {|q| q.default = @default_mime_type }\n+  end\n+\n+  def self.prompt_for_annotations\n+    highline.say('Add annotations (press enter to finish):')\n+    {}.tap do |annotations|\n+      until (name = highline.ask('annotation name: ')).empty?\n+        annotations[name] = read_till_eof('annotation value (^D to finish):')\n+      end\n+    end\n+  end\n+\n+  def self.prompt_for_value\n+    read_till_eof('Enter the value (^D on its own line to finish):')\n+  end\n+  \n+  def self.highline\n+    require 'highline'\n+    @highline ||= HighLine.new($stdin,$stderr)\n+  end\n+\n+  def self.read_till_eof(prompt = nil)\n+    highline.say(prompt) if prompt\n+    [].tap do |lines|","path":"lib/conjur/command/variables.rb","position":132,"original_position":132,"commit_id":"f7065feec5c0b05be9a0a03bbaa2982370abbb82","original_commit_id":"f7065feec5c0b05be9a0a03bbaa2982370abbb82","user":{"login":"dividedmind","id":823636,"avatar_url":"https://avatars.githubusercontent.com/u/823636?v=3","gravatar_id":"","url":"https://api.github.com/users/dividedmind","html_url":"https://github.com/dividedmind","followers_url":"https://api.github.com/users/dividedmind/followers","following_url":"https://api.github.com/users/dividedmind/following{/other_user}","gists_url":"https://api.github.com/users/dividedmind/gists{/gist_id}","starred_url":"https://api.github.com/users/dividedmind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dividedmind/subscriptions","organizations_url":"https://api.github.com/users/dividedmind/orgs","repos_url":"https://api.github.com/users/dividedmind/repos","events_url":"https://api.github.com/users/dividedmind/events{/privacy}","received_events_url":"https://api.github.com/users/dividedmind/received_events","type":"User","site_admin":false},"body":"Why not just `$stdin.read`?","created_at":"2015-05-05T21:06:21Z","updated_at":"2015-05-05T21:06:21Z","html_url":"https://github.com/conjurinc/cli-ruby/pull/104#discussion_r29712975","pull_request_url":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/104","_links":{"self":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/comments/29712975"},"html":{"href":"https://github.com/conjurinc/cli-ruby/pull/104#discussion_r29712975"},"pull_request":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/104"}}},"pull_request":{"url":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/104","id":34669568,"html_url":"https://github.com/conjurinc/cli-ruby/pull/104","diff_url":"https://github.com/conjurinc/cli-ruby/pull/104.diff","patch_url":"https://github.com/conjurinc/cli-ruby/pull/104.patch","issue_url":"https://api.github.com/repos/conjurinc/cli-ruby/issues/104","number":104,"state":"open","locked":false,"title":"Add interactive mode to conjur variable create","user":{"login":"apotterri","id":4212483,"avatar_url":"https://avatars.githubusercontent.com/u/4212483?v=3","gravatar_id":"","url":"https://api.github.com/users/apotterri","html_url":"https://github.com/apotterri","followers_url":"https://api.github.com/users/apotterri/followers","following_url":"https://api.github.com/users/apotterri/following{/other_user}","gists_url":"https://api.github.com/users/apotterri/gists{/gist_id}","starred_url":"https://api.github.com/users/apotterri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apotterri/subscriptions","organizations_url":"https://api.github.com/users/apotterri/orgs","repos_url":"https://api.github.com/users/apotterri/repos","events_url":"https://api.github.com/users/apotterri/events{/privacy}","received_events_url":"https://api.github.com/users/apotterri/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-04T20:03:22Z","updated_at":"2015-05-05T21:06:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b65125782f04e77b32cd4488df74d98c3c24b384","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/104/commits","review_comments_url":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/104/comments","review_comment_url":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/conjurinc/cli-ruby/issues/104/comments","statuses_url":"https://api.github.com/repos/conjurinc/cli-ruby/statuses/f7065feec5c0b05be9a0a03bbaa2982370abbb82","head":{"label":"conjurinc:feature/interactive-create-var","ref":"feature/interactive-create-var","sha":"f7065feec5c0b05be9a0a03bbaa2982370abbb82","user":{"login":"conjurinc","id":4996946,"avatar_url":"https://avatars.githubusercontent.com/u/4996946?v=3","gravatar_id":"","url":"https://api.github.com/users/conjurinc","html_url":"https://github.com/conjurinc","followers_url":"https://api.github.com/users/conjurinc/followers","following_url":"https://api.github.com/users/conjurinc/following{/other_user}","gists_url":"https://api.github.com/users/conjurinc/gists{/gist_id}","starred_url":"https://api.github.com/users/conjurinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conjurinc/subscriptions","organizations_url":"https://api.github.com/users/conjurinc/orgs","repos_url":"https://api.github.com/users/conjurinc/repos","events_url":"https://api.github.com/users/conjurinc/events{/privacy}","received_events_url":"https://api.github.com/users/conjurinc/received_events","type":"Organization","site_admin":false},"repo":{"id":7396761,"name":"cli-ruby","full_name":"conjurinc/cli-ruby","owner":{"login":"conjurinc","id":4996946,"avatar_url":"https://avatars.githubusercontent.com/u/4996946?v=3","gravatar_id":"","url":"https://api.github.com/users/conjurinc","html_url":"https://github.com/conjurinc","followers_url":"https://api.github.com/users/conjurinc/followers","following_url":"https://api.github.com/users/conjurinc/following{/other_user}","gists_url":"https://api.github.com/users/conjurinc/gists{/gist_id}","starred_url":"https://api.github.com/users/conjurinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conjurinc/subscriptions","organizations_url":"https://api.github.com/users/conjurinc/orgs","repos_url":"https://api.github.com/users/conjurinc/repos","events_url":"https://api.github.com/users/conjurinc/events{/privacy}","received_events_url":"https://api.github.com/users/conjurinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/conjurinc/cli-ruby","description":"Conjur command line interface","fork":false,"url":"https://api.github.com/repos/conjurinc/cli-ruby","forks_url":"https://api.github.com/repos/conjurinc/cli-ruby/forks","keys_url":"https://api.github.com/repos/conjurinc/cli-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/conjurinc/cli-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/conjurinc/cli-ruby/teams","hooks_url":"https://api.github.com/repos/conjurinc/cli-ruby/hooks","issue_events_url":"https://api.github.com/repos/conjurinc/cli-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/conjurinc/cli-ruby/events","assignees_url":"https://api.github.com/repos/conjurinc/cli-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/conjurinc/cli-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/conjurinc/cli-ruby/tags","blobs_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/conjurinc/cli-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/conjurinc/cli-ruby/languages","stargazers_url":"https://api.github.com/repos/conjurinc/cli-ruby/stargazers","contributors_url":"https://api.github.com/repos/conjurinc/cli-ruby/contributors","subscribers_url":"https://api.github.com/repos/conjurinc/cli-ruby/subscribers","subscription_url":"https://api.github.com/repos/conjurinc/cli-ruby/subscription","commits_url":"https://api.github.com/repos/conjurinc/cli-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/conjurinc/cli-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/conjurinc/cli-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/conjurinc/cli-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/conjurinc/cli-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/conjurinc/cli-ruby/merges","archive_url":"https://api.github.com/repos/conjurinc/cli-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/conjurinc/cli-ruby/downloads","issues_url":"https://api.github.com/repos/conjurinc/cli-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/conjurinc/cli-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/conjurinc/cli-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/conjurinc/cli-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/conjurinc/cli-ruby/labels{/name}","releases_url":"https://api.github.com/repos/conjurinc/cli-ruby/releases{/id}","created_at":"2013-01-01T16:17:38Z","updated_at":"2015-05-04T19:42:41Z","pushed_at":"2015-05-05T15:49:00Z","git_url":"git://github.com/conjurinc/cli-ruby.git","ssh_url":"git@github.com:conjurinc/cli-ruby.git","clone_url":"https://github.com/conjurinc/cli-ruby.git","svn_url":"https://github.com/conjurinc/cli-ruby","homepage":"https://rubygems.org/gems/conjur-cli","size":3424,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":33,"forks":2,"open_issues":33,"watchers":0,"default_branch":"master"}},"base":{"label":"conjurinc:master","ref":"master","sha":"5df5d91648a63bded0dab54c0b36ee40951a9f50","user":{"login":"conjurinc","id":4996946,"avatar_url":"https://avatars.githubusercontent.com/u/4996946?v=3","gravatar_id":"","url":"https://api.github.com/users/conjurinc","html_url":"https://github.com/conjurinc","followers_url":"https://api.github.com/users/conjurinc/followers","following_url":"https://api.github.com/users/conjurinc/following{/other_user}","gists_url":"https://api.github.com/users/conjurinc/gists{/gist_id}","starred_url":"https://api.github.com/users/conjurinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conjurinc/subscriptions","organizations_url":"https://api.github.com/users/conjurinc/orgs","repos_url":"https://api.github.com/users/conjurinc/repos","events_url":"https://api.github.com/users/conjurinc/events{/privacy}","received_events_url":"https://api.github.com/users/conjurinc/received_events","type":"Organization","site_admin":false},"repo":{"id":7396761,"name":"cli-ruby","full_name":"conjurinc/cli-ruby","owner":{"login":"conjurinc","id":4996946,"avatar_url":"https://avatars.githubusercontent.com/u/4996946?v=3","gravatar_id":"","url":"https://api.github.com/users/conjurinc","html_url":"https://github.com/conjurinc","followers_url":"https://api.github.com/users/conjurinc/followers","following_url":"https://api.github.com/users/conjurinc/following{/other_user}","gists_url":"https://api.github.com/users/conjurinc/gists{/gist_id}","starred_url":"https://api.github.com/users/conjurinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conjurinc/subscriptions","organizations_url":"https://api.github.com/users/conjurinc/orgs","repos_url":"https://api.github.com/users/conjurinc/repos","events_url":"https://api.github.com/users/conjurinc/events{/privacy}","received_events_url":"https://api.github.com/users/conjurinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/conjurinc/cli-ruby","description":"Conjur command line interface","fork":false,"url":"https://api.github.com/repos/conjurinc/cli-ruby","forks_url":"https://api.github.com/repos/conjurinc/cli-ruby/forks","keys_url":"https://api.github.com/repos/conjurinc/cli-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/conjurinc/cli-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/conjurinc/cli-ruby/teams","hooks_url":"https://api.github.com/repos/conjurinc/cli-ruby/hooks","issue_events_url":"https://api.github.com/repos/conjurinc/cli-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/conjurinc/cli-ruby/events","assignees_url":"https://api.github.com/repos/conjurinc/cli-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/conjurinc/cli-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/conjurinc/cli-ruby/tags","blobs_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/conjurinc/cli-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/conjurinc/cli-ruby/languages","stargazers_url":"https://api.github.com/repos/conjurinc/cli-ruby/stargazers","contributors_url":"https://api.github.com/repos/conjurinc/cli-ruby/contributors","subscribers_url":"https://api.github.com/repos/conjurinc/cli-ruby/subscribers","subscription_url":"https://api.github.com/repos/conjurinc/cli-ruby/subscription","commits_url":"https://api.github.com/repos/conjurinc/cli-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/conjurinc/cli-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/conjurinc/cli-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/conjurinc/cli-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/conjurinc/cli-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/conjurinc/cli-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/conjurinc/cli-ruby/merges","archive_url":"https://api.github.com/repos/conjurinc/cli-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/conjurinc/cli-ruby/downloads","issues_url":"https://api.github.com/repos/conjurinc/cli-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/conjurinc/cli-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/conjurinc/cli-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/conjurinc/cli-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/conjurinc/cli-ruby/labels{/name}","releases_url":"https://api.github.com/repos/conjurinc/cli-ruby/releases{/id}","created_at":"2013-01-01T16:17:38Z","updated_at":"2015-05-04T19:42:41Z","pushed_at":"2015-05-05T15:49:00Z","git_url":"git://github.com/conjurinc/cli-ruby.git","ssh_url":"git@github.com:conjurinc/cli-ruby.git","clone_url":"https://github.com/conjurinc/cli-ruby.git","svn_url":"https://github.com/conjurinc/cli-ruby","homepage":"https://rubygems.org/gems/conjur-cli","size":3424,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":33,"forks":2,"open_issues":33,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/104"},"html":{"href":"https://github.com/conjurinc/cli-ruby/pull/104"},"issue":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/issues/104"},"comments":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/issues/104/comments"},"review_comments":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/104/comments"},"review_comment":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/pulls/104/commits"},"statuses":{"href":"https://api.github.com/repos/conjurinc/cli-ruby/statuses/f7065feec5c0b05be9a0a03bbaa2982370abbb82"}}}}