[+] Autocomplete generator script

https://github.com/hykilpikonna/hyfetch/issues/96
This commit is contained in:
Azalea Gui 2023-05-01 16:33:52 -04:00
parent 9747856f15
commit 2007c7c01e
2 changed files with 9 additions and 1 deletions

View file

@ -302,7 +302,7 @@ def create_parser() -> argparse.ArgumentParser:
parser.add_argument('-c', '--config', action='store_true', help=color(f'Configure {hyfetch}')) parser.add_argument('-c', '--config', action='store_true', help=color(f'Configure {hyfetch}'))
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=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=['neofetch', 'fastfetch', 'fastfetch-old'])
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)

8
tools/gen-autocomplete.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Echo all commands
set -x
shtab --shell=bash hyfetch.main.create_parser > hyfetch/scripts/autocomplete.bash
shtab --shell=zsh hyfetch.main.create_parser > hyfetch/scripts/autocomplete.zsh
shtab --shell=tcsh hyfetch.main.create_parser > hyfetch/scripts/autocomplete.csh