Class: Tocer::CLI
- Inherits:
-
Thor
- Object
- Thor
- Tocer::CLI
- Includes:
- Thor::Actions, ThorPlus::Actions
- Defined in:
- lib/tocer/cli.rb
Overview
The Command Line Interface (CLI) for the gem.
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
- #generate(path) ⇒ Object
- #help(task = nil) ⇒ Object
-
#initialize(args = [], options = {}, config = {}) ⇒ CLI
constructor
A new instance of CLI.
- #version ⇒ Object
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ CLI
Returns a new instance of CLI.
23 24 25 |
# File 'lib/tocer/cli.rb', line 23 def initialize args = [], = {}, config = {} super args, , config end |
Class Method Details
Instance Method Details
#config ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/tocer/cli.rb', line 61 def config path = self.class.configuration.computed_path if .edit? then `#{editor} #{path}` elsif .info? then say(path) else help(:config) end end |
#generate(path) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/tocer/cli.rb', line 39 def generate path configuration = build_configuration path, .label, .whitelist runner = build_runner path, configuration files = runner.files runner.run return if files.empty? say "Processed table of contents for:" files.each { |file| say " #{file}" } end |
#help(task = nil) ⇒ Object
78 79 80 |
# File 'lib/tocer/cli.rb', line 78 def help task = nil say and super end |
#version ⇒ Object
72 73 74 |
# File 'lib/tocer/cli.rb', line 72 def version say Identity.version_label end |