Class: GithubCLI::Commands::Issues

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

Constant Summary

Constants inherited from GithubCLI::Command

GithubCLI::Command::ALIASES, GithubCLI::Command::API_CLASSES, 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, api, banner, 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, 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



106
107
108
109
110
111
112
113
114
115
# File 'lib/github_cli/commands/issues.rb', line 106

def create(user, repo)
  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]

  Issue.create user, repo, params, options[:format]
end

#edit(user, repo, number) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/github_cli/commands/issues.rb', line 142

def edit(user, repo, number)
  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]

  Issue.edit user, repo, number, params, options[:format]
end

#get(user, repo, number) ⇒ Object



80
81
82
# File 'lib/github_cli/commands/issues.rb', line 80

def get(user, repo, number)
  Issue.get user, repo, number, options[:params], options[:format]
end

#listObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/github_cli/commands/issues.rb', line 58

def list
  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]
  params['milestone'] = options[:milestone] if options[:milestone]
  params['assignee']  = options[:assignee]  if options[:assignee]
  params['creator']   = options[:creator]   if options[:creator]
  params['mentioned'] = options[:mentioned] if options[:mentioned]
  params['sort']      = options[:sort]      if options[:sort]
  params['state']     = options[:state]     if options[:state]
  params['labels']    = options[:labels]    if options[:labels]
  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]
end