class ShellContext

Attributes

client[RW]
commands[RW]
config[RW]
config_path[RW]
deep[RW]
sysbh[RW]

Public Class Methods

new(user, config_path, argv_token) click to toggle source
# File lib/context.rb, line 13
def initialize(user, config_path, argv_token)
  @commands = {}
  @config_path = config_path
  @sysbh = Sys.new
  @sysbh.write_initial_memory

  if !user.nil?
    @config = @sysbh.load_config_user(config_path, user)
    @client = @sysbh.client
    @deep = User
  else
    @config = @sysbh.load_config(config_path, argv_token) # retorna la configuracion ya guardada anteriormente
    @client = @sysbh.client
    @deep = @sysbh.return_deep(config_path)
  end
  @sysbh.load_memory(config_path, @config)
  unless @client.nil?
    @sysbh.add_history_str(2, Organization.new.read_orgs(@client))
  end

  # let commands class access context variables
  share_context = Commands.new
  share_context.load_enviroment(self)
  @commands = COMMANDS
end

Public Instance Methods

prompt() click to toggle source
# File lib/context.rb, line 39
def prompt
  @deep.shell_prompt(@config)
end