예제 #1
0
파일: next.py 프로젝트: rossem/next
    def get_history(self):
        out, err = self.run_cmd('for val in $history; echo -n $val \\x1e; end')
        hist_tokens = [tk for tk in out.split(' \x1e') if 'cd' in tk]
        print(hist_tokens)
        
        if hist_tokens:
            hist_tokens.pop() # remove the command which started all this shit

        oset = OrderedSet()
        oset.update(hist_tokens)
        self.history = oset
예제 #2
0
파일: next.py 프로젝트: rossem/next
    def get_history(self):
        out, err = self.run_cmd('cat ~/.bash_history')
        hist_tokens = [tk for tk in out.split('\n')[:1000] if 'cd' in tk]
        pprint.pprint(hist_tokens)

        if hist_tokens:
            hist_tokens.pop()

        oset = OrderedSet()
        oset.update(hist_tokens)
        self.history = oset