Exemplo n.º 1
0
    def __init__(self, site):
        cmd.Cmd.__init__(self)
        self.suffix = "=>> "
        self.intro = "Welcome to gsh! "

        self.prompt = site + " " + self.suffix
        self.keywords = ["!", "hist", "exit", "help", "setsite", "getsite", "EOF", "vdt_location", "version"]
        self.home = os.environ["HOME"]
        self.history = "%s/.gsh_history" % self.home
        self.workfile = "%s/gsh_workfile" % self.home

        call(["/bin/touch", self.workfile])
        call(["/bin/touch", self.history])

        # site specific variables
        self.site_env = {}

        self.site = site
        self.site_name = getSiteNameFromFQDN(self.site)
        # register command handler
        self.commandHandler = CommandHandler(self)

        pwd = self.commandHandler.get_pwd(empty_cwd=True)
        self.cwd = pwd.split("/")
        self.old_cwd = None
Exemplo n.º 2
0
    def __init__(self, site, gsh_location):
        cmd.Cmd.__init__(self)
        self.suffix = "=>> "
        self.intro  = "Welcome to gsh! "

        self.prompt = site + " " + self.suffix
        self.keywords = ["!", "hist", "exit", "help", "setsite", "getsite", 
                         "EOF", "vdt_location", "version"]
        self.home = os.environ['HOME']
        self.history = "%s/.gsh_history" % self.home
        self.workfile = "%s/gsh_workfile" % self.home

        call(["/bin/touch", self.workfile])
        call(["/bin/touch", self.history])

        # site specific variables
        self.site_env = {}
        self.site_env["PWD"] = ""

        self.site = site
        self.site_name = getSiteNameFromFQDN(self.site)
        # register command handler
        self.commandHandler = CommandHandler(self)
Exemplo n.º 3
0
 def do_shell(self, args):
     """Pass command to a system shell when line begins with '!'"""
     if isinstance(args, types.StringType):
         args = shlex.split(args)
     call(args)
Exemplo n.º 4
0
    def do_EOF(self, args):
        """Exit on system end of file character"""
        readline.write_history_file(self.history)
        call(["/bin/rm", "-f", self.workfile])

        return self.do_exit(args)