Class: Michael::Commands::Repos::Edit

Inherits:
Models::Guard show all
Defined in:
lib/michael/commands/repos/edit.rb

Instance Attribute Summary

Attributes inherited from Models::Guard

#config, #repos_config

Instance Method Summary collapse

Methods inherited from Michael::Command

#command, #cursor, #editor, #exec_exist?, #generator, #pager, #pastel, #platform, #prompt, #screen, #spinner, #which

Constructor Details

#initialize(options) ⇒ Edit



10
11
12
13
14
# File 'lib/michael/commands/repos/edit.rb', line 10

def initialize(options)
  super()

  @options = options
end

Instance Method Details

#execute(input: $stdin, output: $stdout) ⇒ Object



16
17
18
19
20
21
# File 'lib/michael/commands/repos/edit.rb', line 16

def execute(input: $stdin, output: $stdout)
  list = repos_config.fetch(:repos)
  repos_config.append('org/repo', to: :repos) if list.nil? || list.empty?

  editor.open(repos_config.config_file_path)
end