Class: Termworld::CLI
- Inherits:
-
Thor
- Object
- Thor
- Termworld::CLI
show all
- Defined in:
- lib/termworld/cli.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arg, &block) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/termworld/cli.rb', line 40
def method_missing(method, *arg, &block)
_method = method.to_s.split(?:)
begin
action_class = Object.const_get("Termworld::Commands::#{_method[0].capitalize}Action")
rescue
puts Utils::Color.reden "#{_method[0]} command not found"
return
end
action = action_class.new(_method[1])
return puts Utils::Color.reden "Enter any commands" if arg.empty?
action.send(arg[0], arg[1..-1])
end
|
Instance Method Details
#login ⇒ Object
16
17
18
|
# File 'lib/termworld/cli.rb', line 16
def login
Commands::Account.login
end
|
#logout ⇒ Object
20
21
22
|
# File 'lib/termworld/cli.rb', line 20
def logout
Commands::Account.logout
end
|
#start ⇒ Object
25
26
27
|
# File 'lib/termworld/cli.rb', line 25
def start
Commands::DaemonOperator.start
end
|
#status ⇒ Object
33
34
35
|
# File 'lib/termworld/cli.rb', line 33
def status
Commands::DaemonOperator.status
end
|
#stop ⇒ Object
29
30
31
|
# File 'lib/termworld/cli.rb', line 29
def stop
Commands::DaemonOperator.stop
end
|