🎨 git-status-all: reformat using black
This commit is contained in:
parent
c53e894b5a
commit
728a265aa7
1 changed files with 26 additions and 13 deletions
|
@ -26,7 +26,7 @@ def git_directories(startdir) -> Path:
|
||||||
for dirpath, dirnames, _ in os.walk(startdir):
|
for dirpath, dirnames, _ in os.walk(startdir):
|
||||||
if any(re.search(ignore, dirpath) for ignore in IGNORES):
|
if any(re.search(ignore, dirpath) for ignore in IGNORES):
|
||||||
continue
|
continue
|
||||||
if set(['info', 'objects', 'refs']).issubset(set(dirnames)):
|
if set(["info", "objects", "refs"]).issubset(set(dirnames)):
|
||||||
yield Path(dirpath)
|
yield Path(dirpath)
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,10 +39,17 @@ def working_directory(directory: Path):
|
||||||
|
|
||||||
|
|
||||||
@click.command
|
@click.command
|
||||||
@click.argument('topdirs', nargs=-1, type=click.Path(exists=True, file_okay=False,
|
@click.argument(
|
||||||
path_type=Path))
|
"topdirs", nargs=-1, type=click.Path(exists=True, file_okay=False, path_type=Path)
|
||||||
@click.option('-l', '--list', 'list_', is_flag=True, default=False,
|
)
|
||||||
help='Just list the dirty directories')
|
@click.option(
|
||||||
|
"-l",
|
||||||
|
"--list",
|
||||||
|
"list_",
|
||||||
|
is_flag=True,
|
||||||
|
default=False,
|
||||||
|
help="Just list the dirty directories",
|
||||||
|
)
|
||||||
def search_dirty(topdirs, list_):
|
def search_dirty(topdirs, list_):
|
||||||
"""Search for dirty git working directories in TOPDIRS"""
|
"""Search for dirty git working directories in TOPDIRS"""
|
||||||
if len(topdirs) == 0:
|
if len(topdirs) == 0:
|
||||||
|
@ -61,14 +68,20 @@ def search_dirty(topdirs, list_):
|
||||||
out = subprocess.check_output(['git', 'status', '-s'], stderr=subprocess.STDOUT)
|
out = subprocess.check_output(['git', 'status', '-s'], stderr=subprocess.STDOUT)
|
||||||
if len(out) > 0:
|
if len(out) > 0:
|
||||||
if not list_:
|
if not list_:
|
||||||
print('== {}\n{}'.format(work_tree_directory, out.decode('utf-8')))
|
print(
|
||||||
|
f"== {work_tree_directory}\n"
|
||||||
|
f"{out.decode("utf-8")}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
print(work_tree_directory)
|
print(work_tree_directory)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print((Fore.RED + 'git status is unhappy with {}' + Fore.RESET)
|
print(
|
||||||
.format(work_tree_directory))
|
(
|
||||||
|
Fore.RED + "git status is unhappy with {}" + Fore.RESET
|
||||||
|
).format(work_tree_directory)
|
||||||
|
)
|
||||||
print(e.output)
|
print(e.output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
search_dirty()
|
search_dirty()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue