table style
This commit is contained in:
parent
96ad299cf3
commit
643550a272
1 changed files with 4 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ import os
|
|||
import sys
|
||||
from argparse import ArgumentParser as argp, SUPPRESS, RawTextHelpFormatter as raw
|
||||
from pathlib import Path
|
||||
from rich import box
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
from orvani import OrvaniTag, CONTEXT_FILE, CACHE_FILE, CONTEXTS
|
||||
|
|
@ -10,12 +11,12 @@ from plugins import frontmatter, hashdoubleslash, id3, office, pdf
|
|||
def mktable(query: str, index: dict, filter=None):
|
||||
console = Console()
|
||||
if len(index['found']) > 0:
|
||||
table = Table(title=f"Results for `{query}`")
|
||||
table = Table(title=f"Results for `{query}`", box=box.HORIZONTALS, show_lines=True)
|
||||
ctx = list(CONTEXTS.keys())
|
||||
table.add_column("Path", style="white", no_wrap=True)
|
||||
table.add_column("Path", style="white", no_wrap=False, overflow='fold', max_width=40)
|
||||
styles = ["cyan", "yellow", "magenta", "green"]
|
||||
for i, c in enumerate(ctx):
|
||||
table.add_column(ctx[i].title(), style=styles[i])
|
||||
table.add_column(ctx[i].title(), style=styles[i], max_width=12, overflow='fold')
|
||||
for file in index['found']:
|
||||
item = Path(file)
|
||||
if filter == 'files' and not item.is_file():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue