Class: Ppl::Command::Ls
- Inherits:
-
Application::Command
- Object
- Application::Command
- Ppl::Command::Ls
- Defined in:
- lib/ppl/command/ls.rb
Instance Attribute Summary collapse
-
#custom_format ⇒ Object
writeonly
Sets the attribute custom_format.
-
#default_format ⇒ Object
writeonly
Sets the attribute default_format.
Attributes inherited from Application::Command
Instance Method Summary collapse
Methods inherited from Application::Command
Instance Attribute Details
#custom_format=(value) ⇒ Object (writeonly)
Sets the attribute custom_format
7 8 9 |
# File 'lib/ppl/command/ls.rb', line 7 def custom_format=(value) @custom_format = value end |
#default_format=(value) ⇒ Object (writeonly)
Sets the attribute default_format
6 7 8 |
# File 'lib/ppl/command/ls.rb', line 6 def default_format=(value) @default_format = value end |
Instance Method Details
#execute(input, output) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/ppl/command/ls.rb', line 19 def execute(input, output) address_book = @storage.load_address_book formatted = format_address_book(address_book, input.) output.line(formatted) true end |
#options(parser, options) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/ppl/command/ls.rb', line 9 def (parser, ) parser. = "usage: ppl ls" parser.on("--format <format>", "specify a custom output format") do |format| [:format] = format end parser.on("--pretty <format>", "specify a custom output format") do |pretty| [:pretty] = pretty end end |