Class: Github::Nippou::Commands

Inherits:
Thor
  • Object
show all
Defined in:
lib/github/nippou/commands.rb

Instance Method Summary collapse

Instance Method Details

#initObject



35
36
37
# File 'lib/github/nippou/commands.rb', line 35

def init
  Init.new(settings: settings).run
end

#listObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/github/nippou/commands.rb', line 19

def list
  lines = []
  mutex = Mutex.new
  format = Format.new(settings, debug)

  Parallel.each_with_index(user_events, in_threads: settings.thread_num) do |user_event, i|
    # Contain GitHub access.
    # So should not put into the mutex block.
    line = format.line(user_event, i)
    mutex.synchronize { lines << line }
  end

  puts format.all(lines)
end

#open_settingsObject



40
41
42
43
# File 'lib/github/nippou/commands.rb', line 40

def open_settings
  puts "Open #{settings.url}"
  Launchy.open(settings.url)
end

#versionObject



46
47
48
# File 'lib/github/nippou/commands.rb', line 46

def version
  puts VERSION
end