Skip to content

Commit bdcbabc

Browse files
committed
Update main.py
1 parent 835e0a8 commit bdcbabc

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

file/ptools/main.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,47 @@
44
import platform
55
import importlib.metadata
66
from rich.logging import RichHandler
7+
from rich.console import Console
8+
from rich.panel import Panel
9+
from rich.text import Text
710
import logging
11+
import os
12+
13+
__version__ = "Beta 0.1"
14+
815

916
def main() -> int:
10-
logging.basicConfig(level=logging.DEBUG, format="%(message)s", handlers=[RichHandler()])
17+
console = Console()
18+
panel = Panel(Text("Welcome to the Python Tools application!",
19+
justify="center"),
20+
title="PTools", subtitle="Enjoy your using!",
21+
style="bold green")
22+
console.print(panel)
23+
logging.basicConfig(level=logging.DEBUG, format="%(message)s",
24+
handlers=[RichHandler()])
1125
logging.info("Starting main process.")
26+
logging.debug(f"Platform: {platform.platform()}")
1227
logging.debug(f"Python version: {platform.python_version()}")
1328
logging.debug(f"markdown module version: {markdown.__version__}")
1429
logging.debug(f"rich module version: {importlib.metadata.version('rich')}")
30+
logging.debug(f"PTools module version: {__version__}")
31+
paths = console.input("Input your markdown file [bold]path[/bold] "
32+
'("|" to split): ')
33+
paths = paths.split("|")
34+
logging.debug(f"Input paths: {paths}")
35+
# Does the file exist? Is it a file?
36+
vpaths = []
37+
for path in paths:
38+
if not os.path.exists(path):
39+
logging.warning(f"File not found: {path}")
40+
elif not os.path.isfile(path):
41+
logging.warning(f"Path is not a file: {path}")
42+
else:
43+
vpaths.append(path)
44+
logging.debug(f"Valid paths: {vpaths}")
45+
logging.info("Finished main process.")
1546
return 0
1647

48+
1749
if __name__ == '__main__':
1850
exit(main())

0 commit comments

Comments
 (0)