From 9e473bced8bcd3d6e1f997e66cbe6afef239078d Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 1 Feb 2024 18:04:40 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20git-status-all:=20add=20-l=20to=20j?= =?UTF-8?q?ust=20list=20the=20dirty=20directories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- git-status-all | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/git-status-all b/git-status-all index ca8ac7a..8a4890a 100755 --- a/git-status-all +++ b/git-status-all @@ -40,7 +40,9 @@ def working_directory(directory: Path): @click.command @click.argument('topdirs', nargs=-1) -def search_dirty(topdirs): +@click.option('-l', '--list', 'list_', is_flag=True, default=False, + help='Just list the dirty directories') +def search_dirty(topdirs, list_): """Search for dirty git working directories in TOPDIRS""" if len(topdirs) == 0: topdirs = ["."] @@ -57,7 +59,10 @@ def search_dirty(topdirs): try: out = subprocess.check_output(['git', 'status', '-s'], stderr=subprocess.STDOUT) if len(out) > 0: - print('== {}\n{}'.format(work_tree_directory, out.decode('utf-8'))) + if not list_: + print('== {}\n{}'.format(work_tree_directory, out.decode('utf-8'))) + else: + print(work_tree_directory) except subprocess.CalledProcessError as e: print((Fore.RED + 'git status is unhappy with {}' + Fore.RESET) .format(work_tree_directory))