Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 693616c

Browse files
committed
Add a __main__.py module with main()
1 parent 30be506 commit 693616c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

rptree/__main__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""This module provides the RP Tree CLI."""
2+
3+
import pathlib
4+
import sys
5+
6+
from .cli import parse_cmd_line_arguments
7+
from .rptree import DirectoryTree
8+
9+
10+
def main():
11+
args = parse_cmd_line_arguments()
12+
root_dir = pathlib.Path(args.root_dir)
13+
if not root_dir.is_dir():
14+
print("The specified root directory doesn't exist")
15+
sys.exit()
16+
tree = DirectoryTree(
17+
root_dir, dir_only=args.dir_only, output_file=args.output_file
18+
)
19+
tree.generate()
20+
21+
22+
if __name__ == "__main__":
23+
main()

0 commit comments

Comments
 (0)