Class: Xnlogic::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/xnlogic/cli.rb
Defined Under Namespace
Classes: Application
Class Method Summary collapse
- .handle_no_command_error(command, has_namespace = $thor_runner) ⇒ Object
- .source_root ⇒ Object
- .start ⇒ Object
Instance Method Summary collapse
- #application(name) ⇒ Object
- #help(cli = nil) ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
Class Method Details
.handle_no_command_error(command, has_namespace = $thor_runner) ⇒ Object
51 52 53 54 |
# File 'lib/xnlogic/cli.rb', line 51 def self.handle_no_command_error(command, has_namespace = $thor_runner) return super unless command_path = Xnlogic.which("xnlogic-#{command}") Kernel.exec(command_path, *ARGV[1..-1]) end |
.source_root ⇒ Object
70 71 72 |
# File 'lib/xnlogic/cli.rb', line 70 def self.source_root File.(File.join(File.dirname(__FILE__), 'templates')) end |
Instance Method Details
#application(name) ⇒ Object
65 66 67 68 |
# File 'lib/xnlogic/cli.rb', line 65 def application(name) require 'xnlogic/cli/application' Application.new(, name, self).run end |
#help(cli = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/xnlogic/cli.rb', line 33 def help(cli = nil) case cli when nil then command = "xnlogic" else command = "xnlogic-#{cli}" end manpages = %w(xnlogic) if manpages.include?(command) root = File.("../man", __FILE__) if Xnlogic.which("man") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+} Kernel.exec "man #{root}/#{command}" else puts File.read("#{root}/#{command}.txt") end else super end end |