Class: Fontist::RepoCLI

Inherits:
Thor
  • Object
show all
Includes:
CLI::ClassOptions
Defined in:
lib/fontist/repo_cli.rb

Instance Method Summary collapse

Methods included from CLI::ClassOptions

#handle_class_options, included, #log_level

Instance Method Details

#info(name) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/fontist/repo_cli.rb', line 51

def info(name)
  handle_class_options(options)
  info = Repo.info(name)
  Fontist.ui.say(info.to_s)
  CLI::STATUS_SUCCESS
rescue Errors::RepoNotFoundError
  handle_repo_not_found(name)
end

#listObject



42
43
44
45
46
47
48
# File 'lib/fontist/repo_cli.rb', line 42

def list
  handle_class_options(options)
  Repo.list.each do |name|
    Fontist.ui.say(name)
  end
  CLI::STATUS_SUCCESS
end

#remove(name) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/fontist/repo_cli.rb', line 30

def remove(name)
  handle_class_options(options)
  Repo.remove(name)
  Fontist.ui.success(
    "Fontist repo '#{name}' has been successfully removed.",
  )
  CLI::STATUS_SUCCESS
rescue Errors::RepoNotFoundError
  handle_repo_not_found(name)
end

#setup(name, url) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/fontist/repo_cli.rb', line 8

def setup(name, url)
  handle_class_options(options)
  Repo.setup(name, url)
  Fontist.ui.success(
    "Fontist repo '#{name}' from '#{url}' has been successfully set up.",
  )
  CLI::STATUS_SUCCESS
end

#update(name) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/fontist/repo_cli.rb', line 18

def update(name)
  handle_class_options(options)
  Repo.update(name)
  Fontist.ui.success(
    "Fontist repo '#{name}' has been successfully updated.",
  )
  CLI::STATUS_SUCCESS
rescue Errors::RepoNotFoundError
  handle_repo_not_found(name)
end