예제 #1
0
파일: gsh_console.py 프로젝트: tiradani/gsh
    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
예제 #2
0
파일: gsh_console.py 프로젝트: holzman/gsh
    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)
예제 #3
0
파일: gsh_console.py 프로젝트: holzman/gsh
 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)
예제 #4
0
파일: gsh_console.py 프로젝트: holzman/gsh
    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)