Class: GithubCLI::Commands::References

Inherits:
GithubCLI::Command show all
Defined in:
lib/github_cli/commands/references.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



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

def create(user, repo)
  params = options[:params].dup
  params['ref'] = options[:ref] if options[:ref]
  params['sha'] = options[:sha] if options[:sha]
  Reference.create user, repo, params, options[:format]
end

#delete(user, repo, ref) ⇒ Object



60
61
62
# File 'lib/github_cli/commands/references.rb', line 60

def delete(user, repo, ref)
  Reference.delete user, repo, ref, options[:params], options[:format]
end

#get(user, repo, ref) ⇒ Object



19
20
21
# File 'lib/github_cli/commands/references.rb', line 19

def get(user, repo, ref)
  Reference.get user, repo, ref, options[:params], options[:format]
end

#list(user, repo) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/github_cli/commands/references.rb', line 10

def list(user, repo)
  params = options[:params].dup
  if options[:ref]
    params['ref'] = options[:ref]
  end
  Reference.list user, repo, params, options[:format]
end

#update(user, repo, ref) ⇒ Object



52
53
54
55
56
57
# File 'lib/github_cli/commands/references.rb', line 52

def update(user, repo, ref)
  params = options[:params].dup
  params['sha']   = options[:sha] if options[:sha]
  params['force'] = options[:force] || false
  Reference.update user, repo, ref, params, options[:format]
end