feat: add qwqfetch backend
This commit is contained in:
parent
a97d2805b1
commit
ed377261a2
2 changed files with 23 additions and 1 deletions
|
@ -308,7 +308,7 @@ def create_parser() -> argparse.ArgumentParser:
|
||||||
parser.add_argument('-C', '--config-file', dest='config_file', default=CONFIG_PATH, help=f'Use another config file')
|
parser.add_argument('-C', '--config-file', dest='config_file', default=CONFIG_PATH, help=f'Use another config file')
|
||||||
parser.add_argument('-p', '--preset', help=f'Use preset', choices=list(PRESETS.keys()))
|
parser.add_argument('-p', '--preset', help=f'Use preset', choices=list(PRESETS.keys()))
|
||||||
parser.add_argument('-m', '--mode', help=f'Color mode', choices=['8bit', 'rgb'])
|
parser.add_argument('-m', '--mode', help=f'Color mode', choices=['8bit', 'rgb'])
|
||||||
parser.add_argument('-b', '--backend', help=f'Choose a *fetch backend', choices=['neofetch', 'fastfetch', 'fastfetch-old'])
|
parser.add_argument('-b', '--backend', help=f'Choose a *fetch backend', choices=['qwqfetch', 'neofetch', 'fastfetch', 'fastfetch-old'])
|
||||||
parser.add_argument('--args', help=f'Additional arguments pass-through to backend')
|
parser.add_argument('--args', help=f'Additional arguments pass-through to backend')
|
||||||
parser.add_argument('--c-scale', dest='scale', help=f'Lighten colors by a multiplier', type=float)
|
parser.add_argument('--c-scale', dest='scale', help=f'Lighten colors by a multiplier', type=float)
|
||||||
parser.add_argument('--c-set-l', dest='light', help=f'Set lightness value of the colors', type=float)
|
parser.add_argument('--c-set-l', dest='light', help=f'Set lightness value of the colors', type=float)
|
||||||
|
|
|
@ -345,8 +345,30 @@ def run(asc: str, backend: BackendLiteral, args: str = ''):
|
||||||
return run_fastfetch(asc, args)
|
return run_fastfetch(asc, args)
|
||||||
if backend == "fastfetch-old":
|
if backend == "fastfetch-old":
|
||||||
return run_fastfetch(asc, args, legacy=True)
|
return run_fastfetch(asc, args, legacy=True)
|
||||||
|
if backend == "qwqfetch":
|
||||||
|
return run_qwqfetch(asc, args)
|
||||||
|
|
||||||
|
|
||||||
|
def run_neofetch(asc: str, args: str = ''):
|
||||||
|
"""
|
||||||
|
Run neofetch with colors
|
||||||
|
|
||||||
|
:param preset: Color palette
|
||||||
|
:param alignment: Color alignment settings
|
||||||
|
"""
|
||||||
|
asc = asc.replace('\\', '\\\\')
|
||||||
|
|
||||||
|
# call qwqfetch to print string
|
||||||
|
try:
|
||||||
|
from qwqfetch import src
|
||||||
|
# distro_detector only return a bash variable
|
||||||
|
# so we use qwqfetch builtin distro detector
|
||||||
|
print(src.get_result(asc))
|
||||||
|
except ImportError as e: # module not found etc
|
||||||
|
print("qwqfetch is not installed. Install it by executing:") # use print to output hint directly
|
||||||
|
print("pip install git+https://github.com/nexplorer-3e/qwqfetch") # TODO: public repo
|
||||||
|
raise e
|
||||||
|
|
||||||
def run_neofetch(asc: str, args: str = ''):
|
def run_neofetch(asc: str, args: str = ''):
|
||||||
"""
|
"""
|
||||||
Run neofetch with colors
|
Run neofetch with colors
|
||||||
|
|
Loading…
Reference in a new issue