From a8d56508dfcf19765778b95ddc54d50ba5b8f0c8 Mon Sep 17 00:00:00 2001 From: Tom de Geus Date: Fri, 25 Nov 2022 11:26:48 +0100 Subject: [PATCH] shelephant_get: allow showing only (but all) changed files --- shelephant/cli/shelephant_get.py | 7 +++++++ shelephant/detail.py | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/shelephant/cli/shelephant_get.py b/shelephant/cli/shelephant_get.py index 97f26f5..6f72b48 100644 --- a/shelephant/cli/shelephant_get.py +++ b/shelephant/cli/shelephant_get.py @@ -45,6 +45,9 @@ -d, --details Print details (and no summary unless specified). + --changes + Print changed filed only, do not print skipped files. (Can be combined with ``--details``.) + -f, --force Force overwrite of all existing (but not matching) files. @@ -87,6 +90,7 @@ def print_help(self): parser.add_argument("--colors", default="dark") parser.add_argument("-s", "--summary", action="store_true") parser.add_argument("-d", "--details", action="store_true") + parser.add_argument("--changes", action="store_true") parser.add_argument("-f", "--force", action="store_true") parser.add_argument("--verbose", action="store_true") parser.add_argument("-q", "--quiet", action="store_true") @@ -118,6 +122,7 @@ def print_help(self): print_details=not (args.force or args.summary) or args.details, print_summary=not (args.force or args.details) or args.summary, print_all=args.details, + print_skipped=not args.changes, theme_name=args.colors.lower(), yaml_hostinfo_src=source, yaml_hostinfo_dest=args.local, @@ -140,6 +145,7 @@ def print_help(self): print_details=not (args.force or args.summary) or args.details, print_summary=not (args.force or args.details) or args.summary, print_all=args.details, + print_skipped=not args.changes, verbose=args.verbose, theme_name=args.colors.lower(), yaml_hostinfo_src=source, @@ -163,6 +169,7 @@ def print_help(self): print_details=not (args.force or args.summary) or args.details, print_summary=not (args.force or args.details) or args.summary, print_all=args.details, + print_skipped=not args.changes, verbose=args.verbose, theme_name=args.colors.lower(), yaml_hostinfo_src=source, diff --git a/shelephant/detail.py b/shelephant/detail.py index c8cb8a5..d9666f6 100644 --- a/shelephant/detail.py +++ b/shelephant/detail.py @@ -31,6 +31,7 @@ def copy( print_details=True, print_summary=True, print_all=False, + print_skipped=True, theme_name="none", yaml_hostinfo_src=None, yaml_hostinfo_dest=None, @@ -55,6 +56,7 @@ def copy( :param bool print_details: Print copy details. :param bool print_summary: Print copy summary. :param bool print_all: If ``False`` auto-truncation of long output is applied. + :param bool print_skipped: If ``False`` skipped files are not printed. :type theme_name: str or None :param theme_name: The name of the color-theme. See :py:mod:`shelephant.rich.theme`. @@ -171,7 +173,7 @@ def copy( String(files[i], color=color["new"]).format(), ) ) - elif skip[i] and pskip: + elif skip[i] and pskip and print_skipped: print( "{:s} {:s} {:s}".format( String(files[i], width=width, color=color["skip"]).format(), @@ -226,6 +228,7 @@ def copy_ssh( print_details=True, print_summary=True, print_all=False, + print_skipped=True, verbose=False, theme_name="none", yaml_hostinfo_src=None, @@ -254,6 +257,7 @@ def copy_ssh( :param bool print_details: Print copy details. :param bool print_summary: Print copy summary. :param bool print_all: If ``False`` auto-truncation of long output is applied. + :param bool print_skipped: If ``False`` skipped files are not printed. :type theme_name: str or None :param theme_name: The name of the color-theme. See :py:fun:`shelephant.rich.theme`. @@ -385,7 +389,7 @@ def copy_ssh( String(files[i], color=color["new"]).format(), ) ) - elif skip[i] and pskip: + elif skip[i] and pskip and print_skipped: print( "{:s} {:s} {:s}".format( String(files[i], width=width, color=color["skip"]).format(),