Class: Topicz::Commands::ListCommand
- Inherits:
-
RepositoryCommand
- Object
- RepositoryCommand
- Topicz::Commands::ListCommand
- Defined in:
- lib/topicz/commands/list_command.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(config_file = nil, arguments = []) ⇒ ListCommand
constructor
A new instance of ListCommand.
- #option_parser ⇒ Object
Methods inherited from RepositoryCommand
#find_exactly_one_topic, #load_config, #load_repository, #process_excludes
Constructor Details
#initialize(config_file = nil, arguments = []) ⇒ ListCommand
Returns a new instance of ListCommand.
7 8 9 10 |
# File 'lib/topicz/commands/list_command.rb', line 7 def initialize(config_file = nil, arguments = []) super(config_file) @filter = arguments.join ' ' end |
Instance Method Details
#execute ⇒ Object
26 27 28 |
# File 'lib/topicz/commands/list_command.rb', line 26 def execute @repository.find_all(@filter).each { |topic| puts topic.title } end |
#option_parser ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/topicz/commands/list_command.rb', line 12 def option_parser OptionParser.new do || . = 'Usage: list [<filter>]' .separator '' .separator 'Lists topics' .separator '' .separator 'The filter specifies the text to search on. The text is matched against the topic\'s: ' .separator '- path on the filesystem' .separator '- id, if specified in the topic\'s topic.yaml file' .separator '- title, if specified in the topic\'s topic.yaml file' .separator '- aliases, if specified in the topic\'s topic.yaml file' end end |