-
Notifications
You must be signed in to change notification settings - Fork 17
/
custom_git.py
36 lines (28 loc) · 1.01 KB
/
custom_git.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from typing import List, Iterable
def for_each_ref(glob=None, format=None, sort=None) -> List[str]:
return sum((
["git", "for-each-ref"],
[] if format is None else [f"--format={format}"],
[] if sort is None else [f"--sort={sort}"],
[] if glob is None else [glob],
), [])
def log(selector=None, format=None, limit=None) -> List[str]:
return sum((
["git", "log"],
[] if limit is None else [f"-{limit}"],
[] if format is None else [f"--format={format}"],
[] if selector is None else [selector],
), [])
def show(objects: Iterable[str]=(), diff: bool=True, format: str=None) -> List[str]:
return sum((
["git", "show"],
[] if diff else [f"-s"],
[] if format is None else [f"--format={format}"],
list(objects),
), [])
def cherry(upstream=None, head=None) -> List[str]:
return sum((
["git", "cherry"],
[] if upstream is None else [upstream],
[] if head is None else [head],
), [])