示例#1
0
文件: cli.py 项目: Juniper/OpenClos
 def get_endidx ( self ):
     if util.isPlatformWindows ():
         import pyreadline
         return Readline ().get_endidx ()
     else:
         import readline
         return readline.get_endidx ()
示例#2
0
 def get_endidx(self):
     if util.isPlatformWindows():
         import pyreadline
         return Readline().get_endidx()
     else:
         import readline
         return readline.get_endidx()
示例#3
0
文件: cli.py 项目: Juniper/OpenClos
 def parse_and_bind ( self, complete_key ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().parse_and_bind ( complete_key )
     else:
         import readline
         readline.parse_and_bind ( complete_key )
示例#4
0
文件: cli.py 项目: Juniper/OpenClos
    def get_line_buffer ( self ):
        if util.isPlatformWindows ():
            import pyreadline
            return Readline ().get_line_buffer ()
        else:
            import readline
	    return readline.get_line_buffer()
示例#5
0
文件: cli.py 项目: Juniper/OpenClos
 def set_completion_display_matches_hook ( self, function ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().set_completion_display_matches_hook ( function )
     else:
         import readline
         readline.set_completion_display_matches_hook ( function )
示例#6
0
文件: cli.py 项目: Juniper/OpenClos
 def redisplay ( self ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().redisplay ()
     else:
         import readline
         readline.redisplay ()
示例#7
0
 def insert_text(self, line):
     if util.isPlatformWindows():
         import pyreadline
         Readline().insert_text(line)
     else:
         import readline
         readline.insert_text(line)
示例#8
0
文件: cli.py 项目: Juniper/OpenClos
 def set_completer ( self, comp_func ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().set_completer ( comp_func )
     else:
         import readline
         readline.set_completer ( comp_func )
示例#9
0
文件: cli.py 项目: Juniper/OpenClos
 def insert_text ( self, line ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().insert_text ( line )
     else:
         import readline
         readline.insert_text ( line )
示例#10
0
 def parse_and_bind(self, complete_key):
     if util.isPlatformWindows():
         import pyreadline
         Readline().parse_and_bind(complete_key)
     else:
         import readline
         readline.parse_and_bind(complete_key)
示例#11
0
 def redisplay(self):
     if util.isPlatformWindows():
         import pyreadline
         Readline().redisplay()
     else:
         import readline
         readline.redisplay()
示例#12
0
 def set_completion_display_matches_hook(self, function):
     if util.isPlatformWindows():
         import pyreadline
         Readline().set_completion_display_matches_hook(function)
     else:
         import readline
         readline.set_completion_display_matches_hook(function)
示例#13
0
 def set_completer(self, comp_func):
     if util.isPlatformWindows():
         import pyreadline
         Readline().set_completer(comp_func)
     else:
         import readline
         readline.set_completer(comp_func)
示例#14
0
 def get_completer(self):
     if util.isPlatformWindows():
         import pyreadline
         return Readline().get_completer()
     else:
         import readline
         return readline.get_completer
示例#15
0
文件: ztp.py 项目: ttjinma/OpenClos
 def getTemplate(self):
     ''' 
     Finds template based on o/s on which OpenClos is running
     and 1stage/2stage ZTP process
     returns: jinja2 template 
     '''
     if util.isPlatformUbuntu():
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('ubuntu.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('ubuntu.1stage.dhcp.conf')
     elif util.isPlatformCentos():
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('centos.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('centos.1stage.dhcp.conf')
     elif util.isPlatformWindows():
         ''' 
         this code is for testing only, generated dhcpd.conf would not work on windows  
         '''
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('ubuntu.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('ubuntu.1stage.dhcp.conf')
示例#16
0
文件: ztp.py 项目: codyrat/OpenClos
 def getTemplate(self):
     ''' 
     Finds template based on o/s on which OpenClos is running
     and 1stage/2stage ZTP process
     returns: jinja2 template 
     '''
     if util.isPlatformUbuntu():
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('ubuntu.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('ubuntu.1stage.dhcp.conf')
     elif util.isPlatformCentos():
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('centos.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('centos.1stage.dhcp.conf')
     elif util.isPlatformWindows():
         ''' 
         this code is for testing only, generated dhcpd.conf would not work on windows  
         '''
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('ubuntu.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('ubuntu.1stage.dhcp.conf')
示例#17
0
文件: cli.py 项目: Juniper/OpenClos
 def do_clear ( self, *args ):
     if util.isPlatformWindows ():
         os.system ( 'cls' )
     else:
         os.system ( 'clear' )
示例#18
0
 def do_clear(self, *args):
     if util.isPlatformWindows():
         os.system('cls')
     else:
         os.system('clear')