zele-utils/styles/help.py

38 lines
2.5 KiB
Python
Raw Normal View History

2024-09-10 17:40:50 -04:00
import sys
from rich.table import Table
from rich.console import Console
from rich.console import Group
from rich.padding import Padding
from rich.panel import Panel
def population_help():
line1 = "This CLI tool processes [yellow bold]MATSim population XML files[/yellow bold] and prepares the data for storage in either [green bold].csv[/green bold] file or in [blue bold]PostgreSQL[/blue bold] database with [blue bold]PostGIS[/blue bold] integration."
line2 = "It extracts key data such as coordinates, converting them into a format ready for geospatial.\nUse the available [underline bold]options[/underline bold] to modify the behavior, such as [underline bold]cleaning[/underline bold] the data with missing values, or choosing to either [underline bold]replace[/underline bold] or [underline bold]append[/underline bold] data in the target table."
line3 = "The resulting table structure includes columns such as the following:"
line4 = "[red bold]NOTE:[/red bold] Ensure PostgreSQL connection details are provided via a [underline bold bright_cyan].env[/underline bold bright_cyan] file.\n[red bold]NOTE:[/red bold] By default if a [underline].log[/underline] exist with the same name in the same directory of file, It will use that to prcoess the file"
table = Table("id","lon","lat","geom","time","age","sex","person_id","economic_sector","household_id","household_income")
table.add_row("1","45.89977111012078","-73.26605847316777","0101000020E61000005CED21B32BF3464013451E1A075152C0","07:00:00","4","1","1","0","1","4")
table.add_row("2","45.89977111012078","-73.26605847316777","0101000020E61000005CED21B32BF3464013451E1A075152C0","08:00:00","4","2","2","0","1","4")
lines = f"{line1} \n{line2} \n{line3}"
panel = Padding(Panel(Padding(Group(lines,Padding(table, (1,0)),line4), (1,1)), title="About",title_align="left"), (1,0,0,0))
return panel
def network_help():
test = Padding("Hello network", (1,1))
return Panel(test, title="About",title_align="left")
def metro_help():
test = Padding("Hello network", (1,1))
return Panel(test, title="About",title_align="left")
def bus_help():
test = Padding("Hello network", (1,1))
return Panel(test, title="About",title_align="left")
def print_help():
console = Console()
if "--help" in sys.argv or "-h" in sys.argv:
if (sys.argv[1] == "population"):
console.print(population_help())
elif (sys.argv[1] == "network"):
console.print(network_help())