Class: Sesc::Exporter::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/sesc/exporter/help.rb

Constant Summary collapse

DESCRIPTION =
{
  number: 'Quantidade de eventos a serem listados',
  places: 'Unidades do sesc que podem serem filtradas'
}.freeze
FILTERS =
{
  places: 'Listar todos os SESC'
}.freeze

Class Method Summary collapse

Class Method Details

.alias_for(command) ⇒ Object



56
57
58
# File 'lib/sesc/exporter/help.rb', line 56

def alias_for(command)
  Sesc::Cli::Options::COMMANDS_WITH_OPTIONS[command].join(' ')
end

.descriptionsObject



25
26
27
28
29
30
# File 'lib/sesc/exporter/help.rb', line 25

def descriptions
  DESCRIPTION.each do |command, description|
    text = alias_for(command)
    puts("#{text}#{space_for(text)}#{description}")
  end
end

.filtersObject



46
47
48
49
50
51
52
53
54
# File 'lib/sesc/exporter/help.rb', line 46

def filters
  puts ''
  puts 'Filtros:'
  puts ''

  FILTERS.each do |command, description|
    puts("#{command}#{space_for(command)}#{description}")
  end
end

.headerObject



38
39
40
# File 'lib/sesc/exporter/help.rb', line 38

def header
  puts 'Uso: sesc [filtros...] [opções...]'
end

.helpObject



42
43
44
# File 'lib/sesc/exporter/help.rb', line 42

def help
  puts "-h --help#{space_for('-h --help')}Exibe este texto de ajuda"
end

.optionsObject



32
33
34
35
36
# File 'lib/sesc/exporter/help.rb', line 32

def options
  puts ''
  puts 'Opções:'
  puts ''
end


16
17
18
19
20
21
22
23
# File 'lib/sesc/exporter/help.rb', line 16

def print
  header
  options
  help
  descriptions
  filters
  true
end

.puts(text) ⇒ Object



64
65
66
# File 'lib/sesc/exporter/help.rb', line 64

def puts(text)
  Sesc::Exporter::Printer.new(text.to_s).terminal
end

.space_for(text) ⇒ Object



60
61
62
# File 'lib/sesc/exporter/help.rb', line 60

def space_for(text)
  ' ' * (15 - text.length)
end