From 077d809b6c1b4fa2b065fa5ab761952bab2dae9e Mon Sep 17 00:00:00 2001 From: sij <sij@sij.law> Date: Fri, 17 Jan 2025 22:05:33 +0000 Subject: [PATCH] Update deps --- deps | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/deps b/deps index 8f83106..3d61865 100755 --- a/deps +++ b/deps @@ -317,24 +317,16 @@ def subcmd_install(args): ############################ def subcmd_ls(args): - parser = argparse.ArgumentParser(prog='deps ls', description="List Python imports in a file or directory.") + parser = argparse.ArgumentParser(prog='deps ls', add_help=False) parser.add_argument('-r', '--recurse', action='store_true', help='Recurse into subfolders.') parser.add_argument('path', nargs='?', default='.', - help='File or directory to scan. Defaults to current directory.') - - # Parse the provided arguments - known_args = parser.parse_args(args) + help='File or directory to scan. Default is current directory.') + known_args, _ = parser.parse_known_args(args) path = known_args.path recurse = known_args.recurse - # Ensure the path exists - if not os.path.exists(path): - print(f"Error: Path does not exist: {path}") - return - - # Process imports based on the given path and recursion option imports = find_imports_in_path(path, recurse=recurse) if imports: print("Imports found:") @@ -343,8 +335,6 @@ def subcmd_ls(args): else: print("No Python imports found (or none that require external packages).") - - ############################ # Main ############################ @@ -378,4 +368,3 @@ def main(): if __name__ == "__main__": main() -