Class: Sesc::Exporter::Help
- Inherits:
-
Object
- Object
- Sesc::Exporter::Help
- 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
- .alias_for(command) ⇒ Object
- .descriptions ⇒ Object
- .filters ⇒ Object
- .header ⇒ Object
- .help ⇒ Object
- .options ⇒ Object
- .print ⇒ Object
- .puts(text) ⇒ Object
- .space_for(text) ⇒ Object
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 |
.descriptions ⇒ Object
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 |
.filters ⇒ Object
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 |
.header ⇒ Object
38 39 40 |
# File 'lib/sesc/exporter/help.rb', line 38 def header puts 'Uso: sesc [filtros...] [opções...]' end |
.help ⇒ Object
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 |
.options ⇒ Object
32 33 34 35 36 |
# File 'lib/sesc/exporter/help.rb', line 32 def puts '' puts 'Opções:' puts '' end |
.print ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/sesc/exporter/help.rb', line 16 def print header 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 |