Start work on transfer kitten
This commit is contained in:
parent
72e15d8b4f
commit
672cf9fffe
0
kittens/transfer/__init__.py
Normal file
0
kittens/transfer/__init__.py
Normal file
38
kittens/transfer/main.py
Normal file
38
kittens/transfer/main.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=utf-8
|
||||||
|
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
from kitty.cli import parse_args
|
||||||
|
from kitty.cli_stub import TransferCLIOptions
|
||||||
|
|
||||||
|
|
||||||
|
def option_text() -> str:
|
||||||
|
return '''\
|
||||||
|
--direction -d
|
||||||
|
default=send
|
||||||
|
choices=send,receive
|
||||||
|
Whether to send or receive files.
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
def send_main(cli_opts: TransferCLIOptions, args: List[str]) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def main(args: List[str]) -> None:
|
||||||
|
cli_opts, items = parse_args(
|
||||||
|
args[1:], option_text, '', 'Transfer files over the TTY device',
|
||||||
|
'kitty transfer', result_class=TransferCLIOptions
|
||||||
|
)
|
||||||
|
if not items:
|
||||||
|
raise SystemExit('Usage: kitty +kitten transfer file_or_directory ...')
|
||||||
|
if cli_opts.direction == 'send':
|
||||||
|
send_main(cli_opts, items)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main(sys.argv)
|
||||||
@ -14,7 +14,7 @@ LaunchCLIOptions = AskCLIOptions = ClipboardCLIOptions = DiffCLIOptions = CLIOpt
|
|||||||
HintsCLIOptions = IcatCLIOptions = PanelCLIOptions = ResizeCLIOptions = CLIOptions
|
HintsCLIOptions = IcatCLIOptions = PanelCLIOptions = ResizeCLIOptions = CLIOptions
|
||||||
ErrorCLIOptions = UnicodeCLIOptions = RCOptions = RemoteFileCLIOptions = CLIOptions
|
ErrorCLIOptions = UnicodeCLIOptions = RCOptions = RemoteFileCLIOptions = CLIOptions
|
||||||
QueryTerminalCLIOptions = BroadcastCLIOptions = ShowKeyCLIOptions = CLIOptions
|
QueryTerminalCLIOptions = BroadcastCLIOptions = ShowKeyCLIOptions = CLIOptions
|
||||||
ThemesCLIOptions = CLIOptions
|
ThemesCLIOptions = TransferCLIOptions = CLIOptions
|
||||||
|
|
||||||
|
|
||||||
def generate_stub() -> None:
|
def generate_stub() -> None:
|
||||||
@ -76,6 +76,9 @@ def generate_stub() -> None:
|
|||||||
from kittens.themes.main import OPTIONS
|
from kittens.themes.main import OPTIONS
|
||||||
do(OPTIONS(), 'ThemesCLIOptions')
|
do(OPTIONS(), 'ThemesCLIOptions')
|
||||||
|
|
||||||
|
from kittens.transfer.main import option_text as OPTIONS
|
||||||
|
do(OPTIONS(), 'TransferCLIOptions')
|
||||||
|
|
||||||
from kitty.rc.base import all_command_names, command_for_name
|
from kitty.rc.base import all_command_names, command_for_name
|
||||||
for cmd_name in all_command_names():
|
for cmd_name in all_command_names():
|
||||||
cmd = command_for_name(cmd_name)
|
cmd = command_for_name(cmd_name)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user