Class: GithubCLI::Commands::Gists

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

Constant Summary

Constants inherited from GithubCLI::Command

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

Constants inherited from Thor

Thor::HELP_MAPPINGS, Thor::MANPAGES, Thor::THOR_RESERVED_WORDS, 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, 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?, default_task, desc, global_flags, handle_no_task_error, #help, help, long_desc, map, method_option, method_options, printable_tasks, register, subcommand, subcommands, task_help

Methods included from Thor::Base

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

Instance Method Details

#createObject



42
43
44
# File 'lib/github_cli/commands/gists.rb', line 42

def create
  Gist.create options[:params], options[:format]
end

#delete(id) ⇒ Object



82
83
84
# File 'lib/github_cli/commands/gists.rb', line 82

def delete(id)
  Gist.delete id, options[:params], options[:format]
end

#edit(id) ⇒ Object



57
58
59
# File 'lib/github_cli/commands/gists.rb', line 57

def edit(id)
  Gist.edit id, options[:params], options[:format]
end

#fork(id) ⇒ Object



77
78
79
# File 'lib/github_cli/commands/gists.rb', line 77

def fork(id)
  Gist.fork id, options[:params], options[:format]
end

#get(id) ⇒ Object



27
28
29
# File 'lib/github_cli/commands/gists.rb', line 27

def get(id)
  Gist.get id, options[:params], options[:format]
end

#listObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/github_cli/commands/gists.rb', line 15

def list
  if options[:starred]
    Gist.starred options[:params], options[:format]
  else
    if options[:user]
      options[:params]['user'] = options[:user]
    end
    Gist.all options[:params], options[:format]
  end
end

#star(id) ⇒ Object



62
63
64
# File 'lib/github_cli/commands/gists.rb', line 62

def star(id)
  Gist.star id, options[:params], options[:format]
end

#starred(id) ⇒ Object



72
73
74
# File 'lib/github_cli/commands/gists.rb', line 72

def starred(id)
  Gist.starred? id, options[:params], options[:format]
end

#unstar(id) ⇒ Object



67
68
69
# File 'lib/github_cli/commands/gists.rb', line 67

def unstar(id)
  Gist.unstar id, options[:params], options[:format]
end