From c5938cf482f318e8f3e3b31b0968bf28637a1919 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 9 Jul 2025 16:59:18 +0200 Subject: [PATCH] Optimized parameter --- cli.py | 78 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 13 deletions(-) diff --git a/cli.py b/cli.py index 3d6df39..f6eaf03 100644 --- a/cli.py +++ b/cli.py @@ -4,16 +4,68 @@ def parse_arguments(): parser = argparse.ArgumentParser( description="Scan directories and print/compile file contents." ) - parser.add_argument("paths", nargs='+', help="List of files or directories to scan.") - parser.add_argument("--file-types", nargs='+', default=[], help="Filter by file types (e.g., .txt, .log).") - parser.add_argument("--ignore-file-strings", nargs='+', default=[], help="Ignore files and folders containing these strings.") - parser.add_argument("--ignore-hidden", action='store_true', help="Ignore hidden directories and files.") - parser.add_argument("-v", "--verbose", action='store_true', help="Enable verbose mode.") - parser.add_argument("--no-comments", action='store_true', help="Remove comments from the displayed content based on file type.") - parser.add_argument("--compress", action='store_true', help="Compress code (for supported file types).") - parser.add_argument("--path-contains", nargs='+', default=[], help="Display files whose paths contain one of these strings.") - parser.add_argument("--content-contains", nargs='+', default=[], help="Display files containing one of these strings in their content.") - parser.add_argument("--no-gitignore", action='store_true', help="Do not respect .gitignore files during scan.") - parser.add_argument("--scan-binary-files", action='store_true', help="Scan binary files as well (by default these are ignored).") - - return parser.parse_args() + parser.add_argument( + "paths", + nargs='+', + help="List of files or directories to scan." + ) + parser.add_argument( + "-t", "--file-types", + nargs='+', + default=[], + help="Filter by file types (e.g., .txt, .log)." + ) + parser.add_argument( + "-x", "--ignore-file-strings", + nargs='+', + default=[], + help="Ignore files and folders containing these strings." + ) + parser.add_argument( + "-S", "--show-hidden", + action='store_true', + dest='show_hidden', + default=False, + help="Include hidden directories and files in the scan." + ) + parser.add_argument( + "-v", "--verbose", + action='store_true', + help="Enable verbose mode." + ) + parser.add_argument( + "-N", "--no-comments", + action='store_true', + help="Remove comments from the displayed content based on file type." + ) + parser.add_argument( + "-z", "--compress", + action='store_true', + help="Compress code (for supported file types)." + ) + parser.add_argument( + "-p", "--path-contains", + nargs='+', + default=[], + help="Display files whose paths contain one of these strings." + ) + parser.add_argument( + "-C", "--content-contains", + nargs='+', + default=[], + help="Display files containing one of these strings in their content." + ) + parser.add_argument( + "-G", "--no-gitignore", + action='store_true', + help="Do not respect .gitignore files during scan." + ) + parser.add_argument( + "-b", "--scan-binary-files", + action='store_true', + help="Scan binary files as well (by default these are ignored)." + ) + # Convert show_hidden to ignore_hidden for downstream use + args = parser.parse_args() + args.ignore_hidden = not args.show_hidden + return args