Example #1
0
File: main.py Project: Artie18/goto
 def goto(keyword):
     shortcut = Shortcut.find_by_keyword(keyword)
     if shortcut:
         #posix.chdir(shortcut.path)
         # posix.system('eval echo cd /')
         # popen = subprocess.Popen('cd {0}'.format(shortcut.path), stdout=subprocess.PIPE, shell=True)
         # output = popen.communicate()[0]
         print(output)
         # os.environ.update(output)
     else:
         raise Exception('Keyword not found!')
Example #2
0
File: main.py Project: Artie18/goto
 def list():
     shortcuts = Shortcut.all()
     for keyword, path in shortcuts:
         print("Keyword: {0}, Path: {1}".format(keyword, path))
Example #3
0
File: main.py Project: Artie18/goto
 def delete(keyword):
     shortcut = Shortcut.find_by_keyword(keyword)
     if shortcut:
         shortcut.delete()
     else:
         raise Exception('Keyword not found!')
Example #4
0
File: main.py Project: Artie18/goto
 def find(keyword):
     shortcut = Shortcut.find_by_keyword(keyword)
     if shortcut:
         return shortcut.path
     else:
         raise Exception('Keyword not found!')
Example #5
0
File: main.py Project: Artie18/goto
 def add(keyword, path):
     shortcut = Shortcut(keyword, path)
     shortcut.save()