mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
Add completion for the kittens
This commit is contained in:
@@ -8,17 +8,20 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import sys
|
||||
import tempfile
|
||||
import zipfile
|
||||
from contextlib import suppress
|
||||
from typing import Any, Callable, Dict, Iterator, Match, Optional, Tuple, Union, Type
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterator, Match, Optional, Tuple, Type, Union
|
||||
)
|
||||
from urllib.error import HTTPError
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
from kitty.config import atomic_save, parse_config
|
||||
from kitty.constants import cache_dir, config_dir
|
||||
from kitty.options.types import Options as KittyOptions
|
||||
from kitty.fast_data_types import Color
|
||||
from kitty.options.types import Options as KittyOptions
|
||||
from kitty.utils import reload_conf_in_all_kitties
|
||||
|
||||
from ..choose.match import match
|
||||
@@ -647,3 +650,13 @@ def load_themes(cache_age: float = 1., ignore_no_cache: bool = False) -> Themes:
|
||||
ans.load_from_dir(os.path.join(config_dir, 'themes'))
|
||||
ans.index_map = tuple(ans.themes)
|
||||
return ans
|
||||
|
||||
|
||||
def print_theme_names() -> None:
|
||||
found = False
|
||||
for theme in load_themes(cache_age=-1, ignore_no_cache=True):
|
||||
print(theme.name)
|
||||
found = True
|
||||
if not found:
|
||||
print('Default')
|
||||
sys.stdout.flush()
|
||||
|
||||
@@ -11,12 +11,12 @@ from typing import (
|
||||
Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union
|
||||
)
|
||||
|
||||
from kitty.cli import create_default_opts, parse_args
|
||||
from kitty.cli import CompletionSpec, create_default_opts, parse_args
|
||||
from kitty.cli_stub import ThemesCLIOptions
|
||||
from kitty.config import cached_values_for
|
||||
from kitty.options.types import Options as KittyOptions
|
||||
from kitty.constants import config_dir
|
||||
from kitty.fast_data_types import truncate_point_for_length, wcswidth
|
||||
from kitty.options.types import Options as KittyOptions
|
||||
from kitty.rgb import color_as_sharp, color_from_int
|
||||
from kitty.typing import KeyEventType
|
||||
from kitty.utils import ScreenSize
|
||||
@@ -616,3 +616,4 @@ elif __name__ == '__doc__':
|
||||
cd['usage'] = usage
|
||||
cd['options'] = OPTIONS
|
||||
cd['help_text'] = help_text
|
||||
cd['args_completion'] = CompletionSpec.from_string('type:special group:complete_themes')
|
||||
|
||||
Reference in New Issue
Block a user