Class: Canals::Cli::List

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/canals/cli/list.rb

Instance Method Summary collapse

Instance Method Details

#commands(subcommand = nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/canals/cli/list.rb', line 30

def commands(subcommand=nil)
  thor_class = Canals::Cli::Application
  if !subcommand.nil?
    thor_class = thor_class.subcommand_classes[subcommand]
    if thor_class.nil?
      return
    end
  end

  cmds = thor_class.all_commands.values.select{ |c| c.class == Thor::Command }.map{ |c| c.name }
  say cmds.sort.join " "
end

#environmentsObject



12
13
14
15
# File 'lib/canals/cli/list.rb', line 12

def environments
  envs = Canals.environments.map{ |conf| conf.name }
  say envs.sort.join " "
end

#sessionObject



24
25
26
27
# File 'lib/canals/cli/list.rb', line 24

def session
  tunnels = Canals.session.map{ |conf| conf[:name] }
  say tunnels.sort.join " "
end

#tunnelsObject



18
19
20
21
# File 'lib/canals/cli/list.rb', line 18

def tunnels
  tunnels = Canals.repository.map{ |conf| conf.name }
  say tunnels.sort.join " "
end