Class: Fontist::RepoCLI

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

Instance Method Summary collapse

Instance Method Details

#listObject



37
38
39
40
41
42
# File 'lib/fontist/repo_cli.rb', line 37

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

#remove(name) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/fontist/repo_cli.rb', line 26

def remove(name)
  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



6
7
8
9
10
11
12
# File 'lib/fontist/repo_cli.rb', line 6

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

#update(name) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/fontist/repo_cli.rb', line 15

def update(name)
  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