✨ git-status-all: allow giving the search path on the cmd line
This commit is contained in:
parent
ba0030d418
commit
de53cc79c2
1 changed files with 29 additions and 15 deletions
|
@ -11,6 +11,8 @@ import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
|
|
||||||
# TODO config file (and defaults here)
|
# TODO config file (and defaults here)
|
||||||
IGNORES = [
|
IGNORES = [
|
||||||
|
@ -36,7 +38,15 @@ def working_directory(directory: Path):
|
||||||
os.chdir(saved_cwd)
|
os.chdir(saved_cwd)
|
||||||
|
|
||||||
|
|
||||||
for git_directory in git_directories('.'):
|
@click.command
|
||||||
|
@click.argument('topdirs', nargs=-1)
|
||||||
|
def search_dirty(topdirs):
|
||||||
|
"""Search for dirty git working directories in TOPDIRS"""
|
||||||
|
if len(topdirs) == 0:
|
||||||
|
topdirs = ["."]
|
||||||
|
|
||||||
|
for topdir in topdirs:
|
||||||
|
for git_directory in git_directories(topdir):
|
||||||
# technically,we could have a different GIT_DIR than ".git", but this script
|
# technically,we could have a different GIT_DIR than ".git", but this script
|
||||||
# assumes ".git".
|
# assumes ".git".
|
||||||
if git_directory.parts[-1] != ".git":
|
if git_directory.parts[-1] != ".git":
|
||||||
|
@ -52,3 +62,7 @@ for git_directory in git_directories('.'):
|
||||||
print((Fore.RED + 'git status is unhappy with {}' + Fore.RESET)
|
print((Fore.RED + 'git status is unhappy with {}' + Fore.RESET)
|
||||||
.format(work_tree_directory))
|
.format(work_tree_directory))
|
||||||
print(e.output)
|
print(e.output)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
search_dirty()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue