28 lines
922 B
Python
28 lines
922 B
Python
import os
|
|
import sys
|
|
import argparse
|
|
from tree_structurer import create_tree_structurer, get_structure
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='Display directory structure in a tree-like format')
|
|
parser.add_argument('path', nargs='?', default=os.getcwd(),
|
|
help='Path to analyze (default: current directory)')
|
|
parser.add_argument('-v', '--verbose', action='store_true',
|
|
help='Show more detailed output')
|
|
args = parser.parse_args()
|
|
|
|
try:
|
|
if args.verbose:
|
|
print(f"Analyzing directory: {args.path}")
|
|
create_tree_structurer()
|
|
# Get and print structure directly
|
|
structure = get_structure(args.path)
|
|
for line in structure:
|
|
print(line)
|
|
|
|
except Exception as e:
|
|
print(f"Error: {e}", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main() |