Ejemplo n.º 1
0
    def repl(self):
        PROMPT = self.dropbox.users_get_current_account().email + " > "
        parser = argparse.ArgumentParser(description="Use the sink repl")
        parser.add_argument("command", help="subcommand")

        while True:
            self.args = prompt(PROMPT,
                               vi_mode=True,
                               completer=self.generate_completer(),
                               history=file_history(sh.join_paths(
                                   sh.get_home_dir(), '.sinkhist'))).split(' ')
            args = parser.parse_args(self.args[0:1])
            if not hasattr(self, args.command):
                print("Command not found")
                continue
            getattr(self, args.command)()
Ejemplo n.º 2
0
    def repl(self):
        PROMPT = self.dropbox.users_get_current_account().email + " > "
        parser = argparse.ArgumentParser(description="Use the sink repl")
        parser.add_argument("command", help="subcommand")

        while True:
            self.args = prompt(PROMPT,
                               vi_mode=True,
                               completer=self.generate_completer(),
                               history=file_history(
                                   sh.join_paths(sh.get_home_dir(),
                                                 '.sinkhist'))).split(' ')
            args = parser.parse_args(self.args[0:1])
            if not hasattr(self, args.command):
                print("Command not found")
                continue
            getattr(self, args.command)()
Ejemplo n.º 3
0
 def init_config(self):
     self.conf_file = open(sh.join_paths(sh.get_home_dir(), '.sink'), "r+")
     self.curdir = util.directory(self.conf_file.readline().rstrip())
     #self.curdir = self.__sanitize_dir(self.conf_file.readline().rstrip())
     #self.curdir = sh.get_var(Sink.SINK_DIR, self.curdir)
     self.conf_file.close()
Ejemplo n.º 4
0
 def __unload(self):
     self.conf_file = open(sh.join_paths(sh.get_home_dir(), '.sink'), "w+")
     self.conf_file.write(self.curdir.get_directory())
     #sh.set_var(Sink.SINK_DIR, self.curdir)
     self.conf_file.close()
Ejemplo n.º 5
0
 def init_config(self):
     self.conf_file = open(sh.join_paths(sh.get_home_dir(), '.sink'), "r+")
     self.curdir = util.directory(self.conf_file.readline().rstrip())
     #self.curdir = self.__sanitize_dir(self.conf_file.readline().rstrip())
     #self.curdir = sh.get_var(Sink.SINK_DIR, self.curdir)
     self.conf_file.close()
Ejemplo n.º 6
0
 def __unload(self):
     self.conf_file = open(sh.join_paths(sh.get_home_dir(), '.sink'), "w+")
     self.conf_file.write(self.curdir.get_directory())
     #sh.set_var(Sink.SINK_DIR, self.curdir)
     self.conf_file.close()