Update deps
This commit is contained in:
parent
b18925b73c
commit
379cc41033
1 changed files with 8 additions and 5 deletions
13
deps
13
deps
|
@ -317,22 +317,24 @@ def subcmd_install(args):
|
||||||
############################
|
############################
|
||||||
|
|
||||||
def subcmd_ls(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',
|
parser.add_argument('-r', '--recurse', action='store_true',
|
||||||
help='Recurse into subfolders.')
|
help='Recurse into subfolders.')
|
||||||
parser.add_argument('path', nargs='?', default='.',
|
parser.add_argument('path', nargs='?', default='.',
|
||||||
help='File or directory to scan. Default is current directory.')
|
help='File or directory to scan. Defaults to current directory.')
|
||||||
known_args, remaining_args = parser.parse_known_args(args)
|
|
||||||
|
# Parse the provided arguments
|
||||||
|
known_args = parser.parse_args(args)
|
||||||
|
|
||||||
path = known_args.path
|
path = known_args.path
|
||||||
recurse = known_args.recurse
|
recurse = known_args.recurse
|
||||||
|
|
||||||
# Ensure the path exists and handle imports accordingly
|
# Ensure the path exists
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
print(f"Error: Path does not exist: {path}")
|
print(f"Error: Path does not exist: {path}")
|
||||||
return
|
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)
|
imports = find_imports_in_path(path, recurse=recurse)
|
||||||
if imports:
|
if imports:
|
||||||
print("Imports found:")
|
print("Imports found:")
|
||||||
|
@ -342,6 +344,7 @@ def subcmd_ls(args):
|
||||||
print("No Python imports found (or none that require external packages).")
|
print("No Python imports found (or none that require external packages).")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# Main
|
# Main
|
||||||
############################
|
############################
|
||||||
|
|
Loading…
Add table
Reference in a new issue