mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-09 05:35:19 +02:00
71 lines
1.6 KiB
Python
71 lines
1.6 KiB
Python
#!/usr/bin/env python
|
|
# License: GPLv3 Copyright: 2025, Kovid Goyal <kovid at kovidgoyal.net>
|
|
|
|
import sys
|
|
|
|
from kitty.conf.types import Definition
|
|
from kitty.constants import appname
|
|
from kitty.simple_cli_definitions import CONFIG_HELP, CompletionSpec
|
|
|
|
definition = Definition(
|
|
'!kittens.choose_files',
|
|
)
|
|
|
|
agr = definition.add_group
|
|
egr = definition.end_group
|
|
opt = definition.add_option
|
|
map = definition.add_map
|
|
mma = definition.add_mouse_map
|
|
|
|
def main(args: list[str]) -> None:
|
|
raise SystemExit('This must be run as kitten choose-files')
|
|
|
|
|
|
usage = '[directory to start choosing files in]'
|
|
|
|
|
|
OPTIONS = '''
|
|
--override -o
|
|
type=list
|
|
Override individual configuration options, can be specified multiple times.
|
|
Syntax: :italic:`name=value`.
|
|
|
|
|
|
--config
|
|
type=list
|
|
completion=type:file ext:conf group:"Config files" kwds:none,NONE
|
|
{config_help}
|
|
|
|
|
|
--mode
|
|
type=choices
|
|
choices=file,files,save-file,dir,save-dir,dirs,dir-for-files
|
|
default=file
|
|
The type of object(s) to select
|
|
|
|
|
|
--suggested-save-file-name
|
|
A suggested name when picking a save file.
|
|
|
|
|
|
--suggested-save-file-path
|
|
Path to an existing file to use as the save file.
|
|
'''.format(config_help=CONFIG_HELP.format(conf_name='diff', appname=appname)).format
|
|
|
|
|
|
help_text = '''\
|
|
'''
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main(sys.argv)
|
|
elif __name__ == '__doc__':
|
|
cd = sys.cli_docs # type: ignore
|
|
cd['usage'] = usage
|
|
cd['options'] = OPTIONS
|
|
cd['help_text'] = help_text
|
|
cd['short_desc'] = 'Choose files, fast'
|
|
cd['args_completion'] = CompletionSpec.from_string('type:directory')
|
|
elif __name__ == '__conf__':
|
|
sys.options_definition = definition # type: ignore
|