Class: GithubCLI::Commands::Repositories

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

#branch(user, repo, name) ⇒ Object



143
144
145
# File 'lib/github_cli/commands/repositories.rb', line 143

def branch(user, repo, name)
  Repository.branch user, repo, name, options[:params], options[:format]
end

#branches(user, repo) ⇒ Object



138
139
140
# File 'lib/github_cli/commands/repositories.rb', line 138

def branches(user, repo)
  Repository.branches user, repo, options[:params], options[:format]
end

#contribs(user, repo) ⇒ Object



148
149
150
# File 'lib/github_cli/commands/repositories.rb', line 148

def contribs(user, repo)
  Repository.contributors user, repo, options[:params], options[:format]
end

#create(args) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/github_cli/commands/repositories.rb', line 73

def create(args)
  params = options[:params].dup
  org, params['name'] = Arguments.new(args).parse
  params['org'] = org if org
  params['org'] = options[:org] if options[:org]
  params['description'] = options[:desc] if options[:desc]
  params['homepage'] = options[:home] if options[:home]
  params['private'] = options[:private] if options[:private]
  params['has_issues'] = options[:issues] if options[:issues]
  params['has_wiki'] = options[:wiki] if options[:wiki]
  params['has_downloads'] = options[:downloads] if options[:downloads]
  params['team_id'] = options[:team] if options[:team]
  params['auto_init'] = options[:auto] if options[:auto]
  params['gitignore_template'] = options[:gitignore] if options[:gitignore]

  Repository.create params, options[:format]
end

#delete(user, repo) ⇒ Object



133
134
135
# File 'lib/github_cli/commands/repositories.rb', line 133

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

#edit(user, repo, name) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/github_cli/commands/repositories.rb', line 118

def edit(user, repo, name)
  params = options[:params].dup
  params['name'] = name
  params['description'] = options[:desc] if options[:desc]
  params['homepage'] = options[:home] if options[:home]
  params['private'] = options[:private] if options[:private]
  params['has_issues'] = options[:issues] if options[:issues]
  params['has_wiki'] = options[:wiki] if options[:wiki]
  params['has_downloads'] = options[:downloads] if options[:downloads]
  params['default_branch'] = options[:branch] if options[:branch]

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

#get(user, repo) ⇒ Object



33
34
35
# File 'lib/github_cli/commands/repositories.rb', line 33

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

#langs(user, repo) ⇒ Object



153
154
155
# File 'lib/github_cli/commands/repositories.rb', line 153

def langs(user, repo)
  Repository.languages user, repo, options[:params], options[:format]
end

#listObject



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

def list
  params = options[:params].dup
  params['org']   = options[:org] if options[:org]
  params['user']  = options[:user] if options[:user]
  params['since'] = options[:since] if options[:since]
  params['type']  = options[:type] if options[:type]
  params['sort']  = options[:sort] if options[:sort]
  params['direction'] = options[:direction] if options[:direction]
  Repository.all params, options[:format]
end

#tags(user, repo) ⇒ Object



158
159
160
# File 'lib/github_cli/commands/repositories.rb', line 158

def tags(user, repo)
  Repository.tags user, repo, options[:params], options[:format]
end

#teams(user, repo) ⇒ Object



163
164
165
# File 'lib/github_cli/commands/repositories.rb', line 163

def teams(user, repo)
  Repository.teams user, repo, options[:params], options[:format]
end