Rename kitty-tool to kitten
It's easier to type, and cuter. Also, most, if not all of the TUI parts of kitty's kittens will eventually be re-written into kitten. The only downside I can see is that we cant tab complete kitty anymore, but hopefully there will be less reason to run kitty from the shell as command line tools migrate to kitten. Meowrrrr!!!
This commit is contained in:
parent
60310ced05
commit
6b8e5ea225
2
.gitignore
vendored
2
.gitignore
vendored
@ -12,7 +12,7 @@
|
|||||||
/compile_commands.json
|
/compile_commands.json
|
||||||
/link_commands.json
|
/link_commands.json
|
||||||
/glad/out/
|
/glad/out/
|
||||||
/kitty/launcher/kitty*
|
/kitty/launcher/kitt*
|
||||||
/tools/cmd/at/*_generated.go
|
/tools/cmd/at/*_generated.go
|
||||||
*_generated.go
|
*_generated.go
|
||||||
/*.dSYM/
|
/*.dSYM/
|
||||||
|
|||||||
@ -81,10 +81,10 @@ def run_tests(kitty_exe):
|
|||||||
def build_frozen_tools(kitty_exe):
|
def build_frozen_tools(kitty_exe):
|
||||||
cmd = SETUP_CMD + ['--prefix', os.path.dirname(kitty_exe)] + ['build-frozen-tools']
|
cmd = SETUP_CMD + ['--prefix', os.path.dirname(kitty_exe)] + ['build-frozen-tools']
|
||||||
if run(*cmd, cwd=build_frozen_launcher.writeable_src_dir) != 0:
|
if run(*cmd, cwd=build_frozen_launcher.writeable_src_dir) != 0:
|
||||||
print('Building of frozen kitty-tool failed', file=sys.stderr)
|
print('Building of frozen kitten failed', file=sys.stderr)
|
||||||
os.chdir(KITTY_DIR)
|
os.chdir(KITTY_DIR)
|
||||||
run_shell()
|
run_shell()
|
||||||
raise SystemExit('Building of kitty-tool launcher failed')
|
raise SystemExit('Building of kitten launcher failed')
|
||||||
|
|
||||||
|
|
||||||
def sanitize_source_folder(path: str) -> None:
|
def sanitize_source_folder(path: str) -> None:
|
||||||
|
|||||||
@ -106,9 +106,9 @@ def do_sign(app_dir):
|
|||||||
codesign(fw)
|
codesign(fw)
|
||||||
items = set(os.listdir('.')) - fw
|
items = set(os.listdir('.')) - fw
|
||||||
codesign(expand_dirs(items))
|
codesign(expand_dirs(items))
|
||||||
# Sign kitty-tool
|
# Sign kitten
|
||||||
with current_dir('MacOS'):
|
with current_dir('MacOS'):
|
||||||
codesign('kitty-tool')
|
codesign('kitten')
|
||||||
|
|
||||||
# Now sign the main app
|
# Now sign the main app
|
||||||
codesign(app_dir)
|
codesign(app_dir)
|
||||||
|
|||||||
@ -38,9 +38,9 @@ Detailed list of changes
|
|||||||
0.27.0 [future]
|
0.27.0 [future]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
- A new statically compiled, standalone executable, ``kitty-tool`` (written in Go)
|
- A new statically compiled, standalone executable, ``kitten`` (written in Go)
|
||||||
that can be used on all UNIX-like servers for remote control (``kitty-tool @``),
|
that can be used on all UNIX-like servers for remote control (``kitten @``),
|
||||||
viewing images (``icat``), manipulating the clipboard, etc.
|
viewing images (``kitten icat``), manipulating the clipboard (``kitten clipboard``), etc.
|
||||||
|
|
||||||
- :doc:`clipboard kitten </kittens/clipboard>`: Allow copying arbitrary data types to/from the clipboard, not just plain text
|
- :doc:`clipboard kitten </kittens/clipboard>`: Allow copying arbitrary data types to/from the clipboard, not just plain text
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ Detailed list of changes
|
|||||||
|
|
||||||
- Pass key events mapped to scroll actions to the program running in the terminal when the terminal is in alternate screen mode (:iss:`5839`)
|
- Pass key events mapped to scroll actions to the program running in the terminal when the terminal is in alternate screen mode (:iss:`5839`)
|
||||||
|
|
||||||
- Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitty-tool`` static executable (:iss:`5546`, :iss:`5630`)
|
- Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitten`` static executable (:iss:`5546`, :iss:`5630`)
|
||||||
|
|
||||||
- Add an option :opt:`background_tint_gaps` to control background image tinting for window gaps (:iss:`5596`)
|
- Add an option :opt:`background_tint_gaps` to control background image tinting for window gaps (:iss:`5596`)
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ The ``icat`` kitten can be used to display arbitrary images in the |kitty|
|
|||||||
terminal. Using it is as simple as::
|
terminal. Using it is as simple as::
|
||||||
|
|
||||||
kitty +kitten icat image.jpeg
|
kitty +kitten icat image.jpeg
|
||||||
kitty-tool icat image.jpeg
|
kitten icat image.jpeg
|
||||||
|
|
||||||
It supports all image types supported by `ImageMagick
|
It supports all image types supported by `ImageMagick
|
||||||
<https://www.imagemagick.org>`__. It even works over SSH. For details, see the
|
<https://www.imagemagick.org>`__. It even works over SSH. For details, see the
|
||||||
|
|||||||
@ -41,11 +41,11 @@ with the following command line::
|
|||||||
|
|
||||||
echo -en '\eP@kitty-cmd{"cmd":"ls","version":[0,14,2]}\e\\' | socat - unix:/tmp/test | awk '{ print substr($0, 13, length($0) - 14) }' | jq -c '.data | fromjson' | jq .
|
echo -en '\eP@kitty-cmd{"cmd":"ls","version":[0,14,2]}\e\\' | socat - unix:/tmp/test | awk '{ print substr($0, 13, length($0) - 14) }' | jq -c '.data | fromjson' | jq .
|
||||||
|
|
||||||
There is also the statically compiled stand-alone executable ``kitty-tool``
|
There is also the statically compiled stand-alone executable ``kitten``
|
||||||
that can be used for this, available from the `kitty releases
|
that can be used for this, available from the `kitty releases
|
||||||
<https://github.com/kovidgoyal/kitty/releases>`__ page::
|
<https://github.com/kovidgoyal/kitty/releases>`__ page::
|
||||||
|
|
||||||
kitty-tool @ --help
|
kitten @ --help
|
||||||
|
|
||||||
.. _rc_crypto:
|
.. _rc_crypto:
|
||||||
|
|
||||||
|
|||||||
@ -305,12 +305,12 @@ The remote control protocol
|
|||||||
|
|
||||||
If you wish to develop your own client to talk to |kitty|, you can use the
|
If you wish to develop your own client to talk to |kitty|, you can use the
|
||||||
:doc:`remote control protocol specification <rc_protocol>`. Note that there
|
:doc:`remote control protocol specification <rc_protocol>`. Note that there
|
||||||
is a statically compiled, standalone executable, ``kitty-tool`` available that
|
is a statically compiled, standalone executable, ``kitten`` available that
|
||||||
can be used as a remote control client on any UNIX like computer. This can be
|
can be used as a remote control client on any UNIX like computer. This can be
|
||||||
downloaded and used directly from the `kitty releases
|
downloaded and used directly from the `kitty releases
|
||||||
<https://github.com/kovidgoyal/kitty/releases>`__ page::
|
<https://github.com/kovidgoyal/kitty/releases>`__ page::
|
||||||
|
|
||||||
kitty-tool @ --help
|
kitten @ --help
|
||||||
|
|
||||||
|
|
||||||
.. _search_syntax:
|
.. _search_syntax:
|
||||||
|
|||||||
@ -120,7 +120,7 @@ def generate_completions_for_kitty() -> None:
|
|||||||
# The kitty exe
|
# The kitty exe
|
||||||
print('k := root.AddSubCommand(&cli.Command{'
|
print('k := root.AddSubCommand(&cli.Command{'
|
||||||
'Name:"kitty", SubCommandIsOptional: true, ArgCompleter: cli.CompleteExecutableFirstArg, SubCommandMustBeFirst: true })')
|
'Name:"kitty", SubCommandIsOptional: true, ArgCompleter: cli.CompleteExecutableFirstArg, SubCommandMustBeFirst: true })')
|
||||||
print('kt := root.AddSubCommand(&cli.Command{Name:"kitty-tool", SubCommandMustBeFirst: true })')
|
print('kt := root.AddSubCommand(&cli.Command{Name:"kitten", SubCommandMustBeFirst: true })')
|
||||||
print('tool.KittyToolEntryPoints(kt)')
|
print('tool.KittyToolEntryPoints(kt)')
|
||||||
for opt in go_options_for_seq(parse_option_spec()[0]):
|
for opt in go_options_for_seq(parse_option_spec()[0]):
|
||||||
print(opt.as_option('k'))
|
print(opt.as_option('k'))
|
||||||
|
|||||||
@ -78,7 +78,7 @@ the clipboard. Some examples:
|
|||||||
|
|
||||||
usage = '[files to copy to/from]'
|
usage = '[files to copy to/from]'
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
raise SystemExit('This should be run as kitty-tool clipboard')
|
raise SystemExit('This should be run as kitten clipboard')
|
||||||
elif __name__ == '__doc__':
|
elif __name__ == '__doc__':
|
||||||
from kitty.cli import CompletionSpec
|
from kitty.cli import CompletionSpec
|
||||||
cd = sys.cli_docs # type: ignore
|
cd = sys.cli_docs # type: ignore
|
||||||
|
|||||||
@ -134,7 +134,7 @@ usage = 'image-file-or-url-or-directory ...'
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
raise SystemExit('This should be run as kitty-tool icat')
|
raise SystemExit('This should be run as kitten icat')
|
||||||
elif __name__ == '__doc__':
|
elif __name__ == '__doc__':
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|||||||
@ -182,7 +182,7 @@ def make_tarfile(ssh_opts: SSHOptions, base_env: Dict[str, str], compression: st
|
|||||||
arcname = 'home/' + rd + '/kitty'
|
arcname = 'home/' + rd + '/kitty'
|
||||||
add_data_as_file(tf, arcname + '/version', str_version.encode('ascii'))
|
add_data_as_file(tf, arcname + '/version', str_version.encode('ascii'))
|
||||||
tf.add(shell_integration_dir + '/ssh/kitty', arcname=arcname + '/bin/kitty', filter=normalize_tarinfo)
|
tf.add(shell_integration_dir + '/ssh/kitty', arcname=arcname + '/bin/kitty', filter=normalize_tarinfo)
|
||||||
tf.add(shell_integration_dir + '/ssh/kitty-tool', arcname=arcname + '/bin/kitty-tool', filter=normalize_tarinfo)
|
tf.add(shell_integration_dir + '/ssh/kitten', arcname=arcname + '/bin/kitten', filter=normalize_tarinfo)
|
||||||
tf.add(f'{terminfo_dir}/kitty.terminfo', arcname='home/.terminfo/kitty.terminfo', filter=normalize_tarinfo)
|
tf.add(f'{terminfo_dir}/kitty.terminfo', arcname='home/.terminfo/kitty.terminfo', filter=normalize_tarinfo)
|
||||||
tf.add(glob.glob(f'{terminfo_dir}/*/xterm-kitty')[0], arcname='home/.terminfo/x/xterm-kitty', filter=normalize_tarinfo)
|
tf.add(glob.glob(f'{terminfo_dir}/*/xterm-kitty')[0], arcname='home/.terminfo/x/xterm-kitty', filter=normalize_tarinfo)
|
||||||
return buf.getvalue()
|
return buf.getvalue()
|
||||||
|
|||||||
@ -79,8 +79,8 @@ def kitty_exe() -> str:
|
|||||||
return os.path.join(rpath, 'kitty')
|
return os.path.join(rpath, 'kitty')
|
||||||
|
|
||||||
|
|
||||||
def kitty_tool_exe() -> str:
|
def kitten_exe() -> str:
|
||||||
return os.path.join(os.path.dirname(kitty_exe()), 'kitty-tool')
|
return os.path.join(os.path.dirname(kitty_exe()), 'kitten')
|
||||||
|
|
||||||
|
|
||||||
def _get_config_dir() -> str:
|
def _get_config_dir() -> str:
|
||||||
|
|||||||
@ -26,9 +26,9 @@ def runpy(args: List[str]) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def hold(args: List[str]) -> None:
|
def hold(args: List[str]) -> None:
|
||||||
from kitty.constants import kitty_tool_exe
|
from kitty.constants import kitten_exe
|
||||||
args = ['kitty-tool', '__hold_till_enter__'] + args[1:]
|
args = ['kitten', '__hold_till_enter__'] + args[1:]
|
||||||
os.execvp(kitty_tool_exe(), args)
|
os.execvp(kitten_exe(), args)
|
||||||
|
|
||||||
|
|
||||||
def open_urls(args: List[str]) -> None:
|
def open_urls(args: List[str]) -> None:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ from .child import Child
|
|||||||
from .cli import parse_args
|
from .cli import parse_args
|
||||||
from .cli_stub import LaunchCLIOptions
|
from .cli_stub import LaunchCLIOptions
|
||||||
from .clipboard import set_clipboard_string, set_primary_selection
|
from .clipboard import set_clipboard_string, set_primary_selection
|
||||||
from .constants import kitty_tool_exe, shell_path
|
from .constants import kitten_exe, shell_path
|
||||||
from .fast_data_types import add_timer, get_boss, get_options, get_os_window_title, patch_color_profiles
|
from .fast_data_types import add_timer, get_boss, get_options, get_os_window_title, patch_color_profiles
|
||||||
from .options.utils import env as parse_env
|
from .options.utils import env as parse_env
|
||||||
from .tabs import Tab, TabManager
|
from .tabs import Tab, TabManager
|
||||||
@ -563,7 +563,7 @@ def launch(
|
|||||||
else:
|
else:
|
||||||
if opts.hold:
|
if opts.hold:
|
||||||
cmd = kw['cmd'] or [shell_path]
|
cmd = kw['cmd'] or [shell_path]
|
||||||
kw['cmd'] = [kitty_tool_exe(), '__hold_till_enter__'] + cmd
|
kw['cmd'] = [kitten_exe(), '__hold_till_enter__'] + cmd
|
||||||
if force_target_tab:
|
if force_target_tab:
|
||||||
tab = target_tab
|
tab = target_tab
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -324,24 +324,24 @@ is_wrapped_kitten(const char *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exec_kitty_tool(int argc, char *argv[], char *exe_dir) {
|
exec_kitten(int argc, char *argv[], char *exe_dir) {
|
||||||
char exe[PATH_MAX+1] = {0};
|
char exe[PATH_MAX+1] = {0};
|
||||||
snprintf(exe, PATH_MAX, "%s/kitty-tool", exe_dir);
|
snprintf(exe, PATH_MAX, "%s/kitten", exe_dir);
|
||||||
char **newargv = malloc(sizeof(char*) * (argc + 1));
|
char **newargv = malloc(sizeof(char*) * (argc + 1));
|
||||||
memcpy(newargv, argv, sizeof(char*) * argc);
|
memcpy(newargv, argv, sizeof(char*) * argc);
|
||||||
newargv[argc] = 0;
|
newargv[argc] = 0;
|
||||||
newargv[0] = "kitty-tool";
|
newargv[0] = "kitten";
|
||||||
errno = 0;
|
errno = 0;
|
||||||
execv(exe, argv);
|
execv(exe, argv);
|
||||||
fprintf(stderr, "Failed to execute kitty-tool (%s) with error: %s\n", exe, strerror(errno));
|
fprintf(stderr, "Failed to execute kitten (%s) with error: %s\n", exe, strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
delegate_to_kitty_tool_if_possible(int argc, char *argv[], char* exe_dir) {
|
delegate_to_kitten_if_possible(int argc, char *argv[], char* exe_dir) {
|
||||||
if (argc > 1 && argv[1][0] == '@') exec_kitty_tool(argc, argv, exe_dir);
|
if (argc > 1 && argv[1][0] == '@') exec_kitten(argc, argv, exe_dir);
|
||||||
if (argc > 2 && strcmp(argv[1], "+kitten") == 0 && is_wrapped_kitten(argv[2])) exec_kitty_tool(argc - 1, argv + 1, exe_dir);
|
if (argc > 2 && strcmp(argv[1], "+kitten") == 0 && is_wrapped_kitten(argv[2])) exec_kitten(argc - 1, argv + 1, exe_dir);
|
||||||
if (argc > 3 && strcmp(argv[1], "+") == 0 && strcmp(argv[2], "kitten") == 0 && is_wrapped_kitten(argv[3])) exec_kitty_tool(argc - 2, argv + 2, exe_dir);
|
if (argc > 3 && strcmp(argv[1], "+") == 0 && strcmp(argv[2], "kitten") == 0 && is_wrapped_kitten(argv[3])) exec_kitten(argc - 2, argv + 2, exe_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[], char* envp[]) {
|
int main(int argc, char *argv[], char* envp[]) {
|
||||||
@ -357,7 +357,7 @@ int main(int argc, char *argv[], char* envp[]) {
|
|||||||
if (!read_exe_path(exe, sizeof(exe))) return 1;
|
if (!read_exe_path(exe, sizeof(exe))) return 1;
|
||||||
strncpy(exe_dir_buf, exe, sizeof(exe_dir_buf));
|
strncpy(exe_dir_buf, exe, sizeof(exe_dir_buf));
|
||||||
char *exe_dir = dirname(exe_dir_buf);
|
char *exe_dir = dirname(exe_dir_buf);
|
||||||
delegate_to_kitty_tool_if_possible(argc, argv, exe_dir);
|
delegate_to_kitten_if_possible(argc, argv, exe_dir);
|
||||||
int num, ret=0;
|
int num, ret=0;
|
||||||
char lib[PATH_MAX+1] = {0};
|
char lib[PATH_MAX+1] = {0};
|
||||||
num = snprintf(lib, PATH_MAX, "%s/%s", exe_dir, KITTY_LIB_PATH);
|
num = snprintf(lib, PATH_MAX, "%s/%s", exe_dir, KITTY_LIB_PATH);
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import sys
|
|||||||
from typing import TYPE_CHECKING, Generator, Iterator, List, Optional, Tuple, Union
|
from typing import TYPE_CHECKING, Generator, Iterator, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from .cli_stub import CLIOptions
|
from .cli_stub import CLIOptions
|
||||||
from .constants import kitty_tool_exe
|
from .constants import kitten_exe
|
||||||
from .layout.interface import all_layouts
|
from .layout.interface import all_layouts
|
||||||
from .options.types import Options
|
from .options.types import Options
|
||||||
from .options.utils import resize_window, to_layout_names, window_size
|
from .options.utils import resize_window, to_layout_names, window_size
|
||||||
@ -209,7 +209,7 @@ def create_sessions(
|
|||||||
if special_window is None:
|
if special_window is None:
|
||||||
cmd = args.args if args and args.args else resolved_shell(opts)
|
cmd = args.args if args and args.args else resolved_shell(opts)
|
||||||
if args and args.hold:
|
if args and args.hold:
|
||||||
cmd = [kitty_tool_exe(), '__hold_till_enter__'] + cmd
|
cmd = [kitten_exe(), '__hold_till_enter__'] + cmd
|
||||||
from kitty.tabs import SpecialWindow
|
from kitty.tabs import SpecialWindow
|
||||||
cwd: Optional[str] = args.directory if respect_cwd and args else None
|
cwd: Optional[str] = args.directory if respect_cwd and args else None
|
||||||
special_window = SpecialWindow(cmd, cwd_from=cwd_from, cwd=cwd)
|
special_window = SpecialWindow(cmd, cwd_from=cwd_from, cwd=cwd)
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from typing import (
|
|||||||
from .borders import Border, Borders
|
from .borders import Border, Borders
|
||||||
from .child import Child
|
from .child import Child
|
||||||
from .cli_stub import CLIOptions
|
from .cli_stub import CLIOptions
|
||||||
from .constants import appname, kitty_tool_exe
|
from .constants import appname, kitten_exe
|
||||||
from .fast_data_types import (
|
from .fast_data_types import (
|
||||||
GLFW_MOUSE_BUTTON_LEFT,
|
GLFW_MOUSE_BUTTON_LEFT,
|
||||||
GLFW_MOUSE_BUTTON_MIDDLE,
|
GLFW_MOUSE_BUTTON_MIDDLE,
|
||||||
@ -441,7 +441,7 @@ class Tab: # {{{
|
|||||||
cmd[:0] = shlex.split(line)
|
cmd[:0] = shlex.split(line)
|
||||||
else:
|
else:
|
||||||
cmd[:0] = [resolved_shell(get_options())[0]]
|
cmd[:0] = [resolved_shell(get_options())[0]]
|
||||||
cmd[:0] = [kitty_tool_exe(), '__hold_till_enter__']
|
cmd[:0] = [kitten_exe(), '__hold_till_enter__']
|
||||||
fenv: Dict[str, str] = {}
|
fenv: Dict[str, str] = {}
|
||||||
if env:
|
if env:
|
||||||
fenv.update(env)
|
fenv.update(env)
|
||||||
|
|||||||
@ -985,8 +985,8 @@ def sanitize_control_codes(text: str, replace_with: str = '') -> str:
|
|||||||
def hold_till_enter() -> None:
|
def hold_till_enter() -> None:
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from .constants import kitty_tool_exe
|
from .constants import kitten_exe
|
||||||
subprocess.Popen([kitty_tool_exe(), '__hold_till_enter__']).wait()
|
subprocess.Popen([kitten_exe(), '__hold_till_enter__']).wait()
|
||||||
|
|
||||||
|
|
||||||
def cleanup_ssh_control_masters() -> None:
|
def cleanup_ssh_control_masters() -> None:
|
||||||
|
|||||||
@ -15,12 +15,12 @@ from . import BaseTest
|
|||||||
class TestBuild(BaseTest):
|
class TestBuild(BaseTest):
|
||||||
|
|
||||||
def test_exe(self) -> None:
|
def test_exe(self) -> None:
|
||||||
from kitty.constants import kitty_exe, kitty_tool_exe, str_version
|
from kitty.constants import kitty_exe, kitten_exe, str_version
|
||||||
exe = kitty_exe()
|
exe = kitty_exe()
|
||||||
self.assertTrue(os.access(exe, os.X_OK))
|
self.assertTrue(os.access(exe, os.X_OK))
|
||||||
self.assertTrue(os.path.isfile(exe))
|
self.assertTrue(os.path.isfile(exe))
|
||||||
self.assertIn('kitty', os.path.basename(exe))
|
self.assertIn('kitty', os.path.basename(exe))
|
||||||
exe = kitty_tool_exe()
|
exe = kitten_exe()
|
||||||
self.assertTrue(os.access(exe, os.X_OK))
|
self.assertTrue(os.access(exe, os.X_OK))
|
||||||
self.assertTrue(os.path.isfile(exe))
|
self.assertTrue(os.path.isfile(exe))
|
||||||
self.assertIn(str_version, subprocess.check_output([exe, '--version']).decode())
|
self.assertIn(str_version, subprocess.check_output([exe, '--version']).decode())
|
||||||
@ -68,7 +68,7 @@ class TestBuild(BaseTest):
|
|||||||
q = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
|
q = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
|
||||||
return mode & q == q
|
return mode & q == q
|
||||||
|
|
||||||
for x in ('kitty', 'kitty-tool', 'askpass.py'):
|
for x in ('kitty', 'kitten', 'askpass.py'):
|
||||||
x = os.path.join(shell_integration_dir, 'ssh', x)
|
x = os.path.join(shell_integration_dir, 'ssh', x)
|
||||||
self.assertTrue(is_executable(x), f'{x} is not executable')
|
self.assertTrue(is_executable(x), f'{x} is not executable')
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import shlex
|
|||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from kitty.constants import kitty_tool_exe as kitty_tool
|
from kitty.constants import kitten_exe as kitten
|
||||||
|
|
||||||
from . import BaseTest
|
from . import BaseTest
|
||||||
|
|
||||||
@ -86,10 +86,10 @@ def completion(self: TestCompletion, tdir: str):
|
|||||||
env['HOME'] = os.path.join(tdir, 'sub')
|
env['HOME'] = os.path.join(tdir, 'sub')
|
||||||
env['KITTY_CONFIG_DIRECTORY'] = os.path.join(tdir, 'sub')
|
env['KITTY_CONFIG_DIRECTORY'] = os.path.join(tdir, 'sub')
|
||||||
cp = subprocess.run(
|
cp = subprocess.run(
|
||||||
[kitty_tool(), '__complete__', 'json'],
|
[kitten(), '__complete__', 'json'],
|
||||||
check=True, stdout=subprocess.PIPE, cwd=tdir, input=json.dumps(all_argv).encode(), env=env
|
check=True, stdout=subprocess.PIPE, cwd=tdir, input=json.dumps(all_argv).encode(), env=env
|
||||||
)
|
)
|
||||||
self.assertEqual(cp.returncode, 0, f'kitty-tool __complete__ failed with exit code: {cp.returncode}')
|
self.assertEqual(cp.returncode, 0, f'kitten __complete__ failed with exit code: {cp.returncode}')
|
||||||
return json.loads(cp.stdout)
|
return json.loads(cp.stdout)
|
||||||
|
|
||||||
add('kitty ', has_words('@', '@ls', '+', '+open'))
|
add('kitty ', has_words('@', '@ls', '+', '+open'))
|
||||||
@ -148,9 +148,9 @@ def completion(self: TestCompletion, tdir: str):
|
|||||||
add('kitty @launch --cwd ', has_words('current', 'oldest', 'last_reported'))
|
add('kitty @launch --cwd ', has_words('current', 'oldest', 'last_reported'))
|
||||||
add('kitty @launch --logo ', all_words('exe-not3.png'))
|
add('kitty @launch --logo ', all_words('exe-not3.png'))
|
||||||
add('kitty @launch --logo ~', all_words('~/exe-not3.png'))
|
add('kitty @launch --logo ~', all_words('~/exe-not3.png'))
|
||||||
add('kitty-tool ', has_words('@'))
|
add('kitten ', has_words('@'))
|
||||||
add('kitty-tool ', does_not_have_words('__complete__'))
|
add('kitten ', does_not_have_words('__complete__'))
|
||||||
add('kitty-tool @launch --ty', has_words('--type'))
|
add('kitten @launch --ty', has_words('--type'))
|
||||||
|
|
||||||
add('kitty + ', has_words('launch', 'kitten'))
|
add('kitty + ', has_words('launch', 'kitten'))
|
||||||
add('kitty + kitten ', has_words('icat', 'diff'))
|
add('kitty + kitten ', has_words('icat', 'diff'))
|
||||||
|
|||||||
@ -143,7 +143,7 @@ copy --exclude */w.* d1
|
|||||||
self.ae(contents, {
|
self.ae(contents, {
|
||||||
'g.1', 'g.2', f'{tname}/kitty.terminfo', 'simple-file', 'd1/d2/x', 'd1/y', 'a/sfa', 's1', 's2',
|
'g.1', 'g.2', f'{tname}/kitty.terminfo', 'simple-file', 'd1/d2/x', 'd1/y', 'a/sfa', 's1', 's2',
|
||||||
'.local/share/kitty-ssh-kitten/kitty/version', '.local/share/kitty-ssh-kitten/kitty/bin/kitty',
|
'.local/share/kitty-ssh-kitten/kitty/version', '.local/share/kitty-ssh-kitten/kitty/bin/kitty',
|
||||||
'.local/share/kitty-ssh-kitten/kitty/bin/kitty-tool'
|
'.local/share/kitty-ssh-kitten/kitty/bin/kitten'
|
||||||
})
|
})
|
||||||
self.ae(len(glob.glob(f'{remote_home}/{tname}/*/xterm-kitty')), 2)
|
self.ae(len(glob.glob(f'{remote_home}/{tname}/*/xterm-kitty')), 2)
|
||||||
|
|
||||||
|
|||||||
@ -437,7 +437,7 @@ def files_for_upload() -> Dict[str, str]:
|
|||||||
files[path] = desc
|
files[path] = desc
|
||||||
signatures[path] = f'GPG signature for {desc}'
|
signatures[path] = f'GPG signature for {desc}'
|
||||||
b = len(files)
|
b = len(files)
|
||||||
for path in glob.glob('build/static/kitty-tool-*'):
|
for path in glob.glob('build/static/kitten-*'):
|
||||||
if path.endswith('.sig'):
|
if path.endswith('.sig'):
|
||||||
continue
|
continue
|
||||||
path = os.path.abspath(path)
|
path = os.path.abspath(path)
|
||||||
|
|||||||
30
setup.py
30
setup.py
@ -896,7 +896,7 @@ def update_go_generated_files(args: Options, kitty_exe: str) -> None:
|
|||||||
raise SystemExit(cp.returncode)
|
raise SystemExit(cp.returncode)
|
||||||
|
|
||||||
|
|
||||||
def build_kitty_tool(
|
def build_static_kittens(
|
||||||
args: Options, launcher_dir: str, destination_dir: str = '', for_freeze: bool = False,
|
args: Options, launcher_dir: str, destination_dir: str = '', for_freeze: bool = False,
|
||||||
for_platform: Optional[Tuple[str, str]] = None
|
for_platform: Optional[Tuple[str, str]] = None
|
||||||
) -> str:
|
) -> str:
|
||||||
@ -917,7 +917,7 @@ def build_kitty_tool(
|
|||||||
ld_flags.append('-s')
|
ld_flags.append('-s')
|
||||||
ld_flags.append('-w')
|
ld_flags.append('-w')
|
||||||
cmd += ['-ldflags', ' '.join(ld_flags)]
|
cmd += ['-ldflags', ' '.join(ld_flags)]
|
||||||
dest = os.path.join(destination_dir or launcher_dir, 'kitty-tool')
|
dest = os.path.join(destination_dir or launcher_dir, 'kitten')
|
||||||
if for_platform:
|
if for_platform:
|
||||||
dest += f'-{for_platform[0]}-{for_platform[1]}'
|
dest += f'-{for_platform[0]}-{for_platform[1]}'
|
||||||
src = os.path.abspath('tools/cmd')
|
src = os.path.abspath('tools/cmd')
|
||||||
@ -957,8 +957,8 @@ def build_static_binaries(args: Options, launcher_dir: str) -> None:
|
|||||||
'dragonfly': ('amd64',),
|
'dragonfly': ('amd64',),
|
||||||
}.items():
|
}.items():
|
||||||
for arch in arches_:
|
for arch in arches_:
|
||||||
print('Cross compiling static kitty-tool for:', os_, arch)
|
print('Cross compiling static kitten for:', os_, arch)
|
||||||
build_kitty_tool(args, launcher_dir, args.dir_for_static_binaries, for_platform=(os_, arch))
|
build_static_kittens(args, launcher_dir, args.dir_for_static_binaries, for_platform=(os_, arch))
|
||||||
|
|
||||||
|
|
||||||
def build_launcher(args: Options, launcher_dir: str = '.', bundle_type: str = 'source') -> None:
|
def build_launcher(args: Options, launcher_dir: str = '.', bundle_type: str = 'source') -> None:
|
||||||
@ -1357,7 +1357,7 @@ def create_minimal_macos_bundle(args: Options, launcher_dir: str) -> None:
|
|||||||
with open(os.path.join(kapp, 'Contents/Info.plist'), 'wb') as f:
|
with open(os.path.join(kapp, 'Contents/Info.plist'), 'wb') as f:
|
||||||
f.write(macos_info_plist())
|
f.write(macos_info_plist())
|
||||||
build_launcher(args, bin_dir)
|
build_launcher(args, bin_dir)
|
||||||
build_kitty_tool(args, launcher_dir=bin_dir)
|
build_static_kittens(args, launcher_dir=bin_dir)
|
||||||
kitty_exe = os.path.join(launcher_dir, appname)
|
kitty_exe = os.path.join(launcher_dir, appname)
|
||||||
with suppress(FileNotFoundError):
|
with suppress(FileNotFoundError):
|
||||||
os.remove(kitty_exe)
|
os.remove(kitty_exe)
|
||||||
@ -1384,9 +1384,9 @@ def create_macos_bundle_gunk(dest: str, for_freeze: bool, args: Options) -> str:
|
|||||||
os.symlink(os.path.relpath(kitty_exe, os.path.dirname(in_src_launcher)), in_src_launcher)
|
os.symlink(os.path.relpath(kitty_exe, os.path.dirname(in_src_launcher)), in_src_launcher)
|
||||||
create_macos_app_icon(os.path.join(ddir, 'Contents', 'Resources'))
|
create_macos_app_icon(os.path.join(ddir, 'Contents', 'Resources'))
|
||||||
if not for_freeze:
|
if not for_freeze:
|
||||||
kitty_tool_exe = build_kitty_tool(args, launcher_dir=os.path.dirname(kitty_exe))
|
kitten_exe = build_static_kittens(args, launcher_dir=os.path.dirname(kitty_exe))
|
||||||
os.symlink(os.path.relpath(kitty_tool_exe, os.path.dirname(in_src_launcher)),
|
os.symlink(os.path.relpath(kitten_exe, os.path.dirname(in_src_launcher)),
|
||||||
os.path.join(os.path.dirname(in_src_launcher), os.path.basename(kitty_tool_exe)))
|
os.path.join(os.path.dirname(in_src_launcher), os.path.basename(kitten_exe)))
|
||||||
return str(kitty_exe)
|
return str(kitty_exe)
|
||||||
|
|
||||||
|
|
||||||
@ -1457,7 +1457,7 @@ def package(args: Options, bundle_type: str) -> None:
|
|||||||
if path.endswith('.so'):
|
if path.endswith('.so'):
|
||||||
return True
|
return True
|
||||||
q = path.split(os.sep)[-2:]
|
q = path.split(os.sep)[-2:]
|
||||||
if len(q) == 2 and q[0] == 'ssh' and q[1] in ('askpass.py', 'kitty', 'kitty-tool'):
|
if len(q) == 2 and q[0] == 'ssh' and q[1] in ('askpass.py', 'kitty', 'kitten'):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -1466,7 +1466,7 @@ def package(args: Options, bundle_type: str) -> None:
|
|||||||
path = os.path.join(root, f_)
|
path = os.path.join(root, f_)
|
||||||
os.chmod(path, 0o755 if should_be_executable(path) else 0o644)
|
os.chmod(path, 0o755 if should_be_executable(path) else 0o644)
|
||||||
if not for_freeze and not bundle_type.startswith('macos-'):
|
if not for_freeze and not bundle_type.startswith('macos-'):
|
||||||
build_kitty_tool(args, launcher_dir=launcher_dir)
|
build_static_kittens(args, launcher_dir=launcher_dir)
|
||||||
if not is_macos:
|
if not is_macos:
|
||||||
create_linux_bundle_gunk(ddir, args.libdir_name)
|
create_linux_bundle_gunk(ddir, args.libdir_name)
|
||||||
|
|
||||||
@ -1476,7 +1476,7 @@ def package(args: Options, bundle_type: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def clean_launcher_dir(launcher_dir: str) -> None:
|
def clean_launcher_dir(launcher_dir: str) -> None:
|
||||||
for x in glob.glob(os.path.join(launcher_dir, 'kitty*')):
|
for x in glob.glob(os.path.join(launcher_dir, 'kitt*')):
|
||||||
if os.path.isdir(x):
|
if os.path.isdir(x):
|
||||||
shutil.rmtree(x)
|
shutil.rmtree(x)
|
||||||
else:
|
else:
|
||||||
@ -1566,7 +1566,7 @@ def option_parser() -> argparse.ArgumentParser: # {{{
|
|||||||
p.add_argument(
|
p.add_argument(
|
||||||
'--dir-for-static-binaries',
|
'--dir-for-static-binaries',
|
||||||
default=Options.dir_for_static_binaries,
|
default=Options.dir_for_static_binaries,
|
||||||
help='Where to create the static kitty-tool binaries'
|
help='Where to create the static kitten binary'
|
||||||
)
|
)
|
||||||
p.add_argument(
|
p.add_argument(
|
||||||
'--full',
|
'--full',
|
||||||
@ -1737,17 +1737,17 @@ def main() -> None:
|
|||||||
create_minimal_macos_bundle(args, launcher_dir)
|
create_minimal_macos_bundle(args, launcher_dir)
|
||||||
else:
|
else:
|
||||||
build_launcher(args, launcher_dir=launcher_dir)
|
build_launcher(args, launcher_dir=launcher_dir)
|
||||||
build_kitty_tool(args, launcher_dir=launcher_dir)
|
build_static_kittens(args, launcher_dir=launcher_dir)
|
||||||
elif args.action == 'build-launcher':
|
elif args.action == 'build-launcher':
|
||||||
init_env_from_args(args, False)
|
init_env_from_args(args, False)
|
||||||
build_launcher(args, launcher_dir=launcher_dir)
|
build_launcher(args, launcher_dir=launcher_dir)
|
||||||
build_kitty_tool(args, launcher_dir=launcher_dir)
|
build_static_kittens(args, launcher_dir=launcher_dir)
|
||||||
elif args.action == 'build-frozen-launcher':
|
elif args.action == 'build-frozen-launcher':
|
||||||
init_env_from_args(args, False)
|
init_env_from_args(args, False)
|
||||||
bundle_type = ('macos' if is_macos else 'linux') + '-freeze'
|
bundle_type = ('macos' if is_macos else 'linux') + '-freeze'
|
||||||
build_launcher(args, launcher_dir=os.path.join(args.prefix, 'bin'), bundle_type=bundle_type)
|
build_launcher(args, launcher_dir=os.path.join(args.prefix, 'bin'), bundle_type=bundle_type)
|
||||||
elif args.action == 'build-frozen-tools':
|
elif args.action == 'build-frozen-tools':
|
||||||
build_kitty_tool(args, launcher_dir=args.prefix, for_freeze=True)
|
build_static_kittens(args, launcher_dir=args.prefix, for_freeze=True)
|
||||||
elif args.action == 'linux-package':
|
elif args.action == 'linux-package':
|
||||||
build(args, native_optimizations=False)
|
build(args, native_optimizations=False)
|
||||||
package(args, bundle_type='linux-package')
|
package(args, bundle_type='linux-package')
|
||||||
|
|||||||
@ -209,14 +209,14 @@ _ksi_main() {
|
|||||||
_ksi_prompt[ps0]+="\[\e]133;C\a\]"
|
_ksi_prompt[ps0]+="\[\e]133;C\a\]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias edit-in-kitty="kitty-tool edit-in-kitty"
|
alias edit-in-kitty="kitten edit-in-kitty"
|
||||||
if [[ "${_ksi_prompt[complete]}" == "y" ]]; then
|
if [[ "${_ksi_prompt[complete]}" == "y" ]]; then
|
||||||
_ksi_completions() {
|
_ksi_completions() {
|
||||||
builtin local src
|
builtin local src
|
||||||
builtin local limit
|
builtin local limit
|
||||||
# Send all words up to the word the cursor is currently on
|
# Send all words up to the word the cursor is currently on
|
||||||
builtin let limit=1+$COMP_CWORD
|
builtin let limit=1+$COMP_CWORD
|
||||||
src=$(builtin printf "%s\n" "${COMP_WORDS[@]:0:$limit}" | builtin command kitty-tool __complete__ bash)
|
src=$(builtin printf "%s\n" "${COMP_WORDS[@]:0:$limit}" | builtin command kitten __complete__ bash)
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
builtin eval "${src}"
|
builtin eval "${src}"
|
||||||
fi
|
fi
|
||||||
@ -224,7 +224,7 @@ _ksi_main() {
|
|||||||
builtin complete -F _ksi_completions kitty
|
builtin complete -F _ksi_completions kitty
|
||||||
builtin complete -F _ksi_completions edit-in-kitty
|
builtin complete -F _ksi_completions edit-in-kitty
|
||||||
builtin complete -F _ksi_completions clone-in-kitty
|
builtin complete -F _ksi_completions clone-in-kitty
|
||||||
builtin complete -F _ksi_completions kitty-tool
|
builtin complete -F _ksi_completions kitten
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# wrap our prompt additions in markers we can use to remove them using
|
# wrap our prompt additions in markers we can use to remove them using
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
function __ksi_completions
|
function __ksi_completions
|
||||||
set --local ct (commandline --current-token)
|
set --local ct (commandline --current-token)
|
||||||
set --local tokens (commandline --tokenize --cut-at-cursor --current-process)
|
set --local tokens (commandline --tokenize --cut-at-cursor --current-process)
|
||||||
printf "%s\n" $tokens $ct | command kitty-tool __complete__ fish | source -
|
printf "%s\n" $tokens $ct | command kitten __complete__ fish | source -
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -f -c clone-in-kitty -a "(__ksi_completions)"
|
complete -f -c clone-in-kitty -a "(__ksi_completions)"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
function __ksi_completions
|
function __ksi_completions
|
||||||
set --local ct (commandline --current-token)
|
set --local ct (commandline --current-token)
|
||||||
set --local tokens (commandline --tokenize --cut-at-cursor --current-process)
|
set --local tokens (commandline --tokenize --cut-at-cursor --current-process)
|
||||||
printf "%s\n" $tokens $ct | command kitty-tool __complete__ fish | source -
|
printf "%s\n" $tokens $ct | command kitten __complete__ fish | source -
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -f -c kitty-tool -a "(__ksi_completions)"
|
complete -f -c kitten -a "(__ksi_completions)"
|
||||||
@ -1,7 +1,7 @@
|
|||||||
function __ksi_completions
|
function __ksi_completions
|
||||||
set --local ct (commandline --current-token)
|
set --local ct (commandline --current-token)
|
||||||
set --local tokens (commandline --tokenize --cut-at-cursor --current-process)
|
set --local tokens (commandline --tokenize --cut-at-cursor --current-process)
|
||||||
printf "%s\n" $tokens $ct | command kitty-tool __complete__ fish | source -
|
printf "%s\n" $tokens $ct | command kitten __complete__ fish | source -
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -f -c kitty -a "(__ksi_completions)"
|
complete -f -c kitty -a "(__ksi_completions)"
|
||||||
|
|||||||
@ -156,8 +156,8 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function edit-in-kitty --wraps "kitty-tool edit-in-kitty"
|
function edit-in-kitty --wraps "kitten edit-in-kitty"
|
||||||
kitty-tool edit-in-kitty $argv
|
kitten edit-in-kitty $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
function __ksi_transmit_data -d "Transmit data to kitty using chunked DCS escapes"
|
function __ksi_transmit_data -d "Transmit data to kitty using chunked DCS escapes"
|
||||||
|
|||||||
@ -18,14 +18,14 @@ script_path="$(command readlink -f "$0" 2> /dev/null)"
|
|||||||
script_dir="$(command dirname "$script_path")"
|
script_dir="$(command dirname "$script_path")"
|
||||||
install_dir="$(command dirname "$script_dir")/install-tool"
|
install_dir="$(command dirname "$script_dir")/install-tool"
|
||||||
remote_kitty_version_file="$script_dir/../version"
|
remote_kitty_version_file="$script_dir/../version"
|
||||||
local_kitty_version_file="$install_dir/installed-kitty-tool-version"
|
local_kitty_version_file="$install_dir/installed-kitten-version"
|
||||||
kitty_exe="$install_dir/kitty-tool"
|
kitty_exe="$install_dir/kitten"
|
||||||
local_kitty_version=""
|
local_kitty_version=""
|
||||||
|
|
||||||
[ -f "$kitty_exe" -a -x "$kitty_exe" ] && exec_kitty "$@"
|
[ -f "$kitty_exe" -a -x "$kitty_exe" ] && exec_kitty "$@"
|
||||||
|
|
||||||
# Use kitty-tool from the downloaded kitty installation, if available.
|
# Use kitten from the downloaded kitty installation, if available.
|
||||||
embed_exe="$(command dirname "$script_dir")/install/bin/kitty-tool"
|
embed_exe="$(command dirname "$script_dir")/install/bin/kitten"
|
||||||
[ -f "$embed_exe" -a -x "$embed_exe" ] && {
|
[ -f "$embed_exe" -a -x "$embed_exe" ] && {
|
||||||
kitty_exe="$embed_exe"
|
kitty_exe="$embed_exe"
|
||||||
exec_kitty "$@"
|
exec_kitty "$@"
|
||||||
@ -38,7 +38,7 @@ case "$(command uname)" in
|
|||||||
'NetBSD') OS="netbsd";;
|
'NetBSD') OS="netbsd";;
|
||||||
'OpenBSD') OS="openbsd";;
|
'OpenBSD') OS="openbsd";;
|
||||||
'DragonFlyBSD') OS="dragonfly";;
|
'DragonFlyBSD') OS="dragonfly";;
|
||||||
*) die "kitty-tool pre-built binaries are not available for the $(command uname) operating system";;
|
*) die "kitten pre-built binaries are not available for the $(command uname) operating system";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if command -v curl 2> /dev/null > /dev/null; then
|
if command -v curl 2> /dev/null > /dev/null; then
|
||||||
@ -56,7 +56,7 @@ elif command -v wget 2> /dev/null > /dev/null; then
|
|||||||
command wget --quiet -O- "$1"
|
command wget --quiet -O- "$1"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
die "Neither curl nor wget available, cannot download kitty-tool"
|
die "Neither curl nor wget available, cannot download kitten"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$(command uname -m)" in
|
case "$(command uname -m)" in
|
||||||
@ -74,20 +74,20 @@ release_version=$(fetch_quiet "https://sw.kovidgoyal.net/kitty/current-version.t
|
|||||||
}
|
}
|
||||||
|
|
||||||
release_version="v$release_version"
|
release_version="v$release_version"
|
||||||
# no kitty-tool available till 0.27.0
|
# no kitten available till 0.27.0
|
||||||
case "$release_version" in
|
case "$release_version" in
|
||||||
v0.26.*) release_version="nightly";;
|
v0.26.*) release_version="nightly";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
url="https://github.com/kovidgoyal/kitty/releases/download/$release_version/kitty-tool-$OS-$arch"
|
url="https://github.com/kovidgoyal/kitty/releases/download/$release_version/kitten-$OS-$arch"
|
||||||
|
|
||||||
printf "\033[33mkitty-tool needs to be installed\033[m\n\n"
|
printf "\033[33mkitten needs to be installed\033[m\n\n"
|
||||||
command mkdir -p "$install_dir"
|
command mkdir -p "$install_dir"
|
||||||
printf "Downloading kitty-tool from: \033[32m%s\033[m\n\n" "$url"
|
printf "Downloading kitten from: \033[32m%s\033[m\n\n" "$url"
|
||||||
download_dest="$(command mktemp "$kitty_exe.XXXXXXXXXX")"
|
download_dest="$(command mktemp "$kitty_exe.XXXXXXXXXX")"
|
||||||
fetch "$url" > "$download_dest" || {
|
fetch "$url" > "$download_dest" || {
|
||||||
command rm -f "$download_dest"
|
command rm -f "$download_dest"
|
||||||
die "Failed to download kitty-tool"
|
die "Failed to download kitten"
|
||||||
}
|
}
|
||||||
command chmod 755 "$download_dest"
|
command chmod 755 "$download_dest"
|
||||||
command mv "$download_dest" "$kitty_exe"
|
command mv "$download_dest" "$kitty_exe"
|
||||||
@ -34,7 +34,7 @@ is_wrapped_kitten() {
|
|||||||
|
|
||||||
test "(" "$1" = "+kitten" -a -n "$(is_wrapped_kitten "$2")" ")" -o "(" "$1" = "+" -a "$2" = "kitten" -a "$(is_wrapped_kitten "$3")" ")" && {
|
test "(" "$1" = "+kitten" -a -n "$(is_wrapped_kitten "$2")" ")" -o "(" "$1" = "+" -a "$2" = "kitten" -a "$(is_wrapped_kitten "$3")" ")" && {
|
||||||
if [ "$1" = "+kitten" ]; then shift "1"; else shift "2"; fi
|
if [ "$1" = "+kitten" ]; then shift "1"; else shift "2"; fi
|
||||||
exec kitty-tool "$@"
|
exec kitten "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_dir=""
|
lock_dir=""
|
||||||
|
|||||||
@ -3,5 +3,5 @@
|
|||||||
(( ${+commands[kitty]} )) || builtin return
|
(( ${+commands[kitty]} )) || builtin return
|
||||||
builtin local src cmd=${(F)words:0:$CURRENT}
|
builtin local src cmd=${(F)words:0:$CURRENT}
|
||||||
# Send all words up to the word the cursor is currently on.
|
# Send all words up to the word the cursor is currently on.
|
||||||
src=$(builtin command kitty-tool __complete__ zsh "_matcher=$_matcher" <<<$cmd) || builtin return
|
src=$(builtin command kitten __complete__ zsh "_matcher=$_matcher" <<<$cmd) || builtin return
|
||||||
builtin eval "$src"
|
builtin eval "$src"
|
||||||
|
|||||||
@ -107,7 +107,7 @@ _ksi_deferred_init() {
|
|||||||
builtin autoload -Uz -- $comp_dir/_kitty
|
builtin autoload -Uz -- $comp_dir/_kitty
|
||||||
compdef _kitty kitty
|
compdef _kitty kitty
|
||||||
compdef _kitty clone-in-kitty
|
compdef _kitty clone-in-kitty
|
||||||
compdef _kitty kitty-tool
|
compdef _kitty kitten
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If compdef is not set, compinit has not run yet. In this case we must
|
# If compdef is not set, compinit has not run yet. In this case we must
|
||||||
@ -386,7 +386,7 @@ _ksi_deferred_init() {
|
|||||||
fi
|
fi
|
||||||
builtin unset KITTY_IS_CLONE_LAUNCH KITTY_CLONE_SOURCE_STRATEGIES
|
builtin unset KITTY_IS_CLONE_LAUNCH KITTY_CLONE_SOURCE_STRATEGIES
|
||||||
|
|
||||||
alias edit-in-kitty="kitty-tool edit-in-kitty"
|
alias edit-in-kitty="kitten edit-in-kitty"
|
||||||
|
|
||||||
# Map alt+left/right to move by word if not already mapped. This is expected behavior on macOS and I am tired
|
# Map alt+left/right to move by word if not already mapped. This is expected behavior on macOS and I am tired
|
||||||
# of answering questions about it.
|
# of answering questions about it.
|
||||||
|
|||||||
@ -161,13 +161,13 @@ func exec_command(at_root_command *cli.Command, rl *readline.Readline, cmdline s
|
|||||||
}
|
}
|
||||||
exe, err := os.Executable()
|
exe, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exe, err = exec.LookPath("kitty-tool")
|
exe, err = exec.LookPath("kitten")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Could not find the kitty-tool executable")
|
fmt.Fprintln(os.Stderr, "Could not find the kitten executable")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmdline := []string{"kitty-tool", "@"}
|
cmdline := []string{"kitten", "@"}
|
||||||
cmdline = append(cmdline, parsed_cmdline...)
|
cmdline = append(cmdline, parsed_cmdline...)
|
||||||
cmd := exec.Cmd{Path: exe, Args: cmdline, Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr}
|
cmd := exec.Cmd{Path: exe, Args: cmdline, Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr}
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
@ -185,14 +185,14 @@ func exec_command(at_root_command *cli.Command, rl *readline.Readline, cmdline s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func completions(before_cursor, after_cursor string) (ans *cli.Completions) {
|
func completions(before_cursor, after_cursor string) (ans *cli.Completions) {
|
||||||
const prefix = "kitty-tool @ "
|
const prefix = "kitten @ "
|
||||||
text := prefix + before_cursor
|
text := prefix + before_cursor
|
||||||
argv, position_of_last_arg := shlex.SplitForCompletion(text)
|
argv, position_of_last_arg := shlex.SplitForCompletion(text)
|
||||||
if len(argv) == 0 || position_of_last_arg < len(prefix) {
|
if len(argv) == 0 || position_of_last_arg < len(prefix) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
root := cli.NewRootCommand()
|
root := cli.NewRootCommand()
|
||||||
c := root.AddSubCommand(&cli.Command{Name: "kitty-tool"})
|
c := root.AddSubCommand(&cli.Command{Name: "kitten"})
|
||||||
EntryPoint(c)
|
EntryPoint(c)
|
||||||
root.Validate()
|
root.Validate()
|
||||||
ans = root.GetCompletions(argv, nil)
|
ans = root.GetCompletions(argv, nil)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
root := cli.NewRootCommand()
|
root := cli.NewRootCommand()
|
||||||
root.ShortDescription = "Fast, statically compiled implementations for various kitty command-line tools"
|
root.ShortDescription = "Fast, statically compiled implementations for various kittens (command line tools for use with kitty)"
|
||||||
root.Usage = "command [command options] [command args]"
|
root.Usage = "command [command options] [command args]"
|
||||||
root.Run = func(cmd *cli.Command, args []string) (int, error) {
|
root.Run = func(cmd *cli.Command, args []string) (int, error) {
|
||||||
cmd.ShowHelp()
|
cmd.ShowHelp()
|
||||||
|
|||||||
@ -27,14 +27,14 @@ func update_self(version string) (err error) {
|
|||||||
exe := ""
|
exe := ""
|
||||||
exe, err = os.Executable()
|
exe, err = os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to determine path to kitty-tool: %w", err)
|
return fmt.Errorf("Failed to determine path to kitten: %w", err)
|
||||||
}
|
}
|
||||||
exe, err = filepath.EvalSymlinks(exe)
|
exe, err = filepath.EvalSymlinks(exe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !kitty.IsStandaloneBuild {
|
if !kitty.IsStandaloneBuild {
|
||||||
return fmt.Errorf("This is not a standalone kitty-tool executable. You must update all of kitty instead.")
|
return fmt.Errorf("This is not a standalone kitten executable. You must update all of kitty instead.")
|
||||||
}
|
}
|
||||||
rv := "v" + version
|
rv := "v" + version
|
||||||
if version == "nightly" {
|
if version == "nightly" {
|
||||||
@ -44,8 +44,8 @@ func update_self(version string) (err error) {
|
|||||||
if version == "latest" {
|
if version == "latest" {
|
||||||
url_base = "https://github.com/kovidgoyal/kitty/releases/latest/download"
|
url_base = "https://github.com/kovidgoyal/kitty/releases/latest/download"
|
||||||
}
|
}
|
||||||
url := fmt.Sprintf("%s/kitty-tool-%s-%s", url_base, runtime.GOOS, runtime.GOARCH)
|
url := fmt.Sprintf("%s/kitten-%s-%s", url_base, runtime.GOOS, runtime.GOARCH)
|
||||||
dest, err := os.CreateTemp(filepath.Dir(exe), "kitty-tool.")
|
dest, err := os.CreateTemp(filepath.Dir(exe), "kitten.")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -65,15 +65,15 @@ func update_self(version string) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Print("Updated to: ")
|
fmt.Print("Updated to: ")
|
||||||
return unix.Exec(exe, []string{"kitty-tool", "--version"}, os.Environ())
|
return unix.Exec(exe, []string{"kitten", "--version"}, os.Environ())
|
||||||
}
|
}
|
||||||
|
|
||||||
func EntryPoint(root *cli.Command) *cli.Command {
|
func EntryPoint(root *cli.Command) *cli.Command {
|
||||||
sc := root.AddSubCommand(&cli.Command{
|
sc := root.AddSubCommand(&cli.Command{
|
||||||
Name: "update-self",
|
Name: "update-self",
|
||||||
Usage: "update-self [options ...]",
|
Usage: "update-self [options ...]",
|
||||||
ShortDescription: "Update this kitty-tool binary",
|
ShortDescription: "Update this kitten binary",
|
||||||
HelpText: "Update this kitty-tool binary in place to the latest available version.",
|
HelpText: "Update this kitten binary in place to the latest available version.",
|
||||||
Run: func(cmd *cli.Command, args []string) (ret int, err error) {
|
Run: func(cmd *cli.Command, args []string) (ret int, err error) {
|
||||||
if len(args) != 0 {
|
if len(args) != 0 {
|
||||||
return 1, fmt.Errorf("No command line arguments are allowed")
|
return 1, fmt.Errorf("No command line arguments are allowed")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user