lib/github_cli/commands/issues.rb in github_cli-0.5.9 vs lib/github_cli/commands/issues.rb in github_cli-0.6.0

- old
+ new

@@ -54,10 +54,11 @@ sort - created, updated, comments, default: created \n direction - asc, desc, default: desc \n since - Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ \n DESC def list + global_options = options.dup params = options[:params].dup params['org'] = options[:org] if options[:org] params['user'] = options[:user] if options[:user] params['repo'] = options[:repo] if options[:repo] params['filter'] = options[:filter] if options[:filter] @@ -71,16 +72,22 @@ params['direction'] = options[:direction] if options[:direction] params['since'] = options[:since] if options[:since] arg = [] arg = :user if !options[:all] && !(options[:user] || options[:org]) - Issue.all arg, params, options[:format] + Util.hash_without!(global_options, params.keys + ['params', 'all']) + + Issue.all arg, params, global_options end desc 'get <user> <repo> <number>', 'Get a single issue' def get(user, repo, number) - Issue.get user, repo, number, options[:params], options[:format] + global_options = options.dup + params = options[:params].dup + Util.hash_without!(global_options, params.keys + ['params']) + + Issue.get user, repo, number, params, global_options end option :title, :type => :string, :required => true option :body, :type => :string option :assignee, :type => :string, @@ -102,18 +109,20 @@ Example ghc issue create wycats thor --title='Found a bug' DESC def create(user, repo) + global_options = options.dup params = options[:params].dup params['title'] = options[:title] params['body'] = options[:body] if options[:body] params['assignee'] = options[:assignee] if options[:assignee] params['milestone'] = options[:milestone] if options[:milestone] params['labels'] = options[:labels] if options[:labels] + Util.hash_without!(global_options, params.keys + ['params']) - Issue.create user, repo, params, options[:format] + Issue.create user, repo, params, global_options end option :title, :type => :string, :required => true option :body, :type => :string option :assignee, :type => :string, @@ -138,18 +147,20 @@ Example ghc issue edit wycats thor 1 --title='Found a bug' DESC def edit(user, repo, number) + global_options = options.dup params = options[:params].dup params['title'] = options[:title] params['body'] = options[:body] if options[:body] params['assignee'] = options[:assignee] if options[:assignee] params['milestone'] = options[:milestone] if options[:milestone] params['labels'] = options[:labels] if options[:labels] params['state'] = options[:state] if options[:state] + Util.hash_without!(global_options, params.keys + ['params']) - Issue.edit user, repo, number, params, options[:format] + Issue.edit user, repo, number, params, global_options end end # Issues end # GithubCLI