show unstaged and unmerged files for the entire repository
[yap.git] / yap / util.py
blob3c71e3d6d57b45f20d0b7be5479905006f898422
1 import yap
2 import os
4 def get_output(cmd):
5 fd = os.popen(cmd)
6 output = fd.readlines()
7 rc = fd.close()
8 return [x.strip() for x in output]
10 def run_command(cmd):
11 rc = os.system("%s > /dev/null 2>&1" % cmd)
12 rc >>= 8
13 return rc
15 def run_safely(cmd):
16 rc = run_command(cmd)
17 if rc:
18 raise yap.ShellError(cmd, rc)
20 def takes_options(options):
21 def decorator(func):
22 func.options = options
23 return func
24 return decorator
26 def short_help(help_msg):
27 def decorator(func):
28 func.short_help = help_msg
29 return func
30 return decorator
32 def long_help(help_msg):
33 def decorator(func):
34 func.long_help = help_msg
35 return func
36 return decorator