Class: GithubCLI::Commands::Milestones

Inherits:
GithubCLI::Command show all
Defined in:
lib/github_cli/commands/milestones.rb

Constant Summary

Constants inherited from GithubCLI::Command

GithubCLI::Command::ALIASES, GithubCLI::Command::HELP_COMMAND

Constants inherited from Thor

Thor::DynamicTask, Thor::HELP_MAPPINGS, Thor::HiddenTask, Thor::MANPAGES, Thor::THOR_RESERVED_WORDS, Thor::Task, Thor::UndefinedTaskError, Thor::VERSION

Instance Attribute Summary

Attributes included from Thor::Actions

#behavior

Attributes included from Thor::Base

#args, #options, #parent_options

Instance Method Summary collapse

Methods inherited from GithubCLI::Command

all, command_to_show, extract_namespace, is_api_command?, output_formats

Methods included from Thor::Actions

#action, #append_to_file, #apply, #chmod, #comment_lines, #copy_file, #create_file, #create_link, #destination_root, #destination_root=, #directory, #empty_directory, #find_in_source_paths, #gsub_file, #in_root, included, #initialize, #inject_into_class, #insert_into_file, #inside, #link_file, #prepend_to_file, #relative_to_original_destination_root, #remove_file, #run, #run_ruby_script, #source_paths, #template, #thor, #uncomment_lines

Methods inherited from Thor

check_unknown_options!, check_unknown_options?, command_help, default_command, desc, global_flags, handle_no_task_error, help, #help, long_desc, map, method_option, method_options, package_name, printable_commands, register, stop_on_unknown_option!, stop_on_unknown_option?, subcommand, subcommands

Methods included from Thor::Base

included, #initialize, register_klass_file, shell, shell=, subclass_files, subclasses

Instance Method Details

#create(user, repo) ⇒ Object



58
59
60
61
62
63
64
65
66
67
# File 'lib/github_cli/commands/milestones.rb', line 58

def create(user, repo)
  global_options = options.dup
  params = options[:params].dup
  params['title']       = options[:title]
  params['state']       = options[:state]  if options[:state]
  params['description'] = options[:desc]   if options[:desc]
  params['due_on']      = options[:due_on] if options[:due_on]
  Util.hash_without!(global_options, params.keys + ['params'])
  Milestone.create user, repo, params, global_options
end

#delete(user, repo, number) ⇒ Object



99
100
101
102
103
104
# File 'lib/github_cli/commands/milestones.rb', line 99

def delete(user, repo, number)
  global_options = options.dup
  params = options[:params].dup
  Util.hash_without!(global_options, params.keys + ['params'])
  Milestone.delete user, repo, number, params, global_options
end

#get(user, repo, number) ⇒ Object



33
34
35
36
37
38
# File 'lib/github_cli/commands/milestones.rb', line 33

def get(user, repo, number)
  global_options = options.dup
  params = options[:params].dup
  Util.hash_without!(global_options, params.keys + ['params'])
  Milestone.get user, repo, number, params, global_options
end

#list(user, repo) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/github_cli/commands/milestones.rb', line 22

def list(user, repo)
  global_options = options.dup
  params = options[:params].dup
  params['state']     = options[:state] || 'open'
  params['sort']      = options[:sort] || 'due_date'
  params['direction'] = options[:direction] || 'desc'
  Util.hash_without!(global_options, params.keys + ['params'])
  Milestone.all user, repo, params, global_options
end

#update(user, repo, number) ⇒ Object



87
88
89
90
91
92
93
94
95
96
# File 'lib/github_cli/commands/milestones.rb', line 87

def update(user, repo, number)
  global_options = options.dup
  params = options[:params].dup
  params['title']       = options[:title]  if options[:title]
  params['state']       = options[:state]  if options[:state]
  params['description'] = options[:desc]   if options[:desc]
  params['due_on']      = options[:due_on] if options[:due_on]
  Util.hash_without!(global_options, params.keys + ['params'])
  Milestone.update user, repo, number, params, global_options
end