Update deps

This commit is contained in:
Sangye Ince-Johannsen 2025-01-17 22:03:42 +00:00
parent b18925b73c
commit 379cc41033

13
deps
View file

@ -317,22 +317,24 @@ def subcmd_install(args):
############################
def subcmd_ls(args):
parser = argparse.ArgumentParser(prog='deps ls', add_help=False)
parser = argparse.ArgumentParser(prog='deps ls', description="List Python imports in a file or directory.")
parser.add_argument('-r', '--recurse', action='store_true',
help='Recurse into subfolders.')
parser.add_argument('path', nargs='?', default='.',
help='File or directory to scan. Default is current directory.')
known_args, remaining_args = parser.parse_known_args(args)
help='File or directory to scan. Defaults to current directory.')
# Parse the provided arguments
known_args = parser.parse_args(args)
path = known_args.path
recurse = known_args.recurse
# Ensure the path exists and handle imports accordingly
# Ensure the path exists
if not os.path.exists(path):
print(f"Error: Path does not exist: {path}")
return
# Call the import finder with the specified options
# Process imports based on the given path and recursion option
imports = find_imports_in_path(path, recurse=recurse)
if imports:
print("Imports found:")
@ -342,6 +344,7 @@ def subcmd_ls(args):
print("No Python imports found (or none that require external packages).")
############################
# Main
############################