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:
Kovid Goyal 2023-01-14 15:40:34 +05:30
parent 60310ced05
commit 6b8e5ea225
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
35 changed files with 103 additions and 103 deletions

2
.gitignore vendored
View File

@ -12,7 +12,7 @@
/compile_commands.json
/link_commands.json
/glad/out/
/kitty/launcher/kitty*
/kitty/launcher/kitt*
/tools/cmd/at/*_generated.go
*_generated.go
/*.dSYM/

View File

@ -81,10 +81,10 @@ def run_tests(kitty_exe):
def build_frozen_tools(kitty_exe):
cmd = SETUP_CMD + ['--prefix', os.path.dirname(kitty_exe)] + ['build-frozen-tools']
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)
run_shell()
raise SystemExit('Building of kitty-tool launcher failed')
raise SystemExit('Building of kitten launcher failed')
def sanitize_source_folder(path: str) -> None:

View File

@ -106,9 +106,9 @@ def do_sign(app_dir):
codesign(fw)
items = set(os.listdir('.')) - fw
codesign(expand_dirs(items))
# Sign kitty-tool
# Sign kitten
with current_dir('MacOS'):
codesign('kitty-tool')
codesign('kitten')
# Now sign the main app
codesign(app_dir)

View File

@ -38,9 +38,9 @@ Detailed list of changes
0.27.0 [future]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new statically compiled, standalone executable, ``kitty-tool`` (written in Go)
that can be used on all UNIX-like servers for remote control (``kitty-tool @``),
viewing images (``icat``), manipulating the clipboard, etc.
- A new statically compiled, standalone executable, ``kitten`` (written in Go)
that can be used on all UNIX-like servers for remote control (``kitten @``),
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
@ -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`)
- 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`)

View File

@ -7,7 +7,7 @@ The ``icat`` kitten can be used to display arbitrary images in the |kitty|
terminal. Using it is as simple as::
kitty +kitten icat image.jpeg
kitty-tool icat image.jpeg
kitten icat image.jpeg
It supports all image types supported by `ImageMagick
<https://www.imagemagick.org>`__. It even works over SSH. For details, see the

View File

@ -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 .
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
<https://github.com/kovidgoyal/kitty/releases>`__ page::
kitty-tool @ --help
kitten @ --help
.. _rc_crypto:

View File

@ -305,12 +305,12 @@ The remote control protocol
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
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
downloaded and used directly from the `kitty releases
<https://github.com/kovidgoyal/kitty/releases>`__ page::
kitty-tool @ --help
kitten @ --help
.. _search_syntax:

View File

@ -120,7 +120,7 @@ def generate_completions_for_kitty() -> None:
# The kitty exe
print('k := root.AddSubCommand(&cli.Command{'
'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)')
for opt in go_options_for_seq(parse_option_spec()[0]):
print(opt.as_option('k'))

View File

@ -78,7 +78,7 @@ the clipboard. Some examples:
usage = '[files to copy to/from]'
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__':
from kitty.cli import CompletionSpec
cd = sys.cli_docs # type: ignore

View File

@ -134,7 +134,7 @@ usage = 'image-file-or-url-or-directory ...'
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__':
import sys

View File

@ -182,7 +182,7 @@ def make_tarfile(ssh_opts: SSHOptions, base_env: Dict[str, str], compression: st
arcname = 'home/' + rd + '/kitty'
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-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(glob.glob(f'{terminfo_dir}/*/xterm-kitty')[0], arcname='home/.terminfo/x/xterm-kitty', filter=normalize_tarinfo)
return buf.getvalue()

View File

@ -79,8 +79,8 @@ def kitty_exe() -> str:
return os.path.join(rpath, 'kitty')
def kitty_tool_exe() -> str:
return os.path.join(os.path.dirname(kitty_exe()), 'kitty-tool')
def kitten_exe() -> str:
return os.path.join(os.path.dirname(kitty_exe()), 'kitten')
def _get_config_dir() -> str:

View File

@ -26,9 +26,9 @@ def runpy(args: List[str]) -> None:
def hold(args: List[str]) -> None:
from kitty.constants import kitty_tool_exe
args = ['kitty-tool', '__hold_till_enter__'] + args[1:]
os.execvp(kitty_tool_exe(), args)
from kitty.constants import kitten_exe
args = ['kitten', '__hold_till_enter__'] + args[1:]
os.execvp(kitten_exe(), args)
def open_urls(args: List[str]) -> None:

View File

@ -12,7 +12,7 @@ from .child import Child
from .cli import parse_args
from .cli_stub import LaunchCLIOptions
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 .options.utils import env as parse_env
from .tabs import Tab, TabManager
@ -563,7 +563,7 @@ def launch(
else:
if opts.hold:
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:
tab = target_tab
else:

View File

@ -324,24 +324,24 @@ is_wrapped_kitten(const char *arg) {
}
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};
snprintf(exe, PATH_MAX, "%s/kitty-tool", exe_dir);
snprintf(exe, PATH_MAX, "%s/kitten", exe_dir);
char **newargv = malloc(sizeof(char*) * (argc + 1));
memcpy(newargv, argv, sizeof(char*) * argc);
newargv[argc] = 0;
newargv[0] = "kitty-tool";
newargv[0] = "kitten";
errno = 0;
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);
}
static void
delegate_to_kitty_tool_if_possible(int argc, char *argv[], char* exe_dir) {
if (argc > 1 && argv[1][0] == '@') exec_kitty_tool(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 > 3 && strcmp(argv[1], "+") == 0 && strcmp(argv[2], "kitten") == 0 && is_wrapped_kitten(argv[3])) exec_kitty_tool(argc - 2, argv + 2, exe_dir);
delegate_to_kitten_if_possible(int argc, char *argv[], char* 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_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_kitten(argc - 2, argv + 2, exe_dir);
}
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;
strncpy(exe_dir_buf, exe, sizeof(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;
char lib[PATH_MAX+1] = {0};
num = snprintf(lib, PATH_MAX, "%s/%s", exe_dir, KITTY_LIB_PATH);

View File

@ -6,7 +6,7 @@ import sys
from typing import TYPE_CHECKING, Generator, Iterator, List, Optional, Tuple, Union
from .cli_stub import CLIOptions
from .constants import kitty_tool_exe
from .constants import kitten_exe
from .layout.interface import all_layouts
from .options.types import Options
from .options.utils import resize_window, to_layout_names, window_size
@ -209,7 +209,7 @@ def create_sessions(
if special_window is None:
cmd = args.args if args and args.args else resolved_shell(opts)
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
cwd: Optional[str] = args.directory if respect_cwd and args else None
special_window = SpecialWindow(cmd, cwd_from=cwd_from, cwd=cwd)

View File

@ -28,7 +28,7 @@ from typing import (
from .borders import Border, Borders
from .child import Child
from .cli_stub import CLIOptions
from .constants import appname, kitty_tool_exe
from .constants import appname, kitten_exe
from .fast_data_types import (
GLFW_MOUSE_BUTTON_LEFT,
GLFW_MOUSE_BUTTON_MIDDLE,
@ -441,7 +441,7 @@ class Tab: # {{{
cmd[:0] = shlex.split(line)
else:
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] = {}
if env:
fenv.update(env)

View File

@ -985,8 +985,8 @@ def sanitize_control_codes(text: str, replace_with: str = '') -> str:
def hold_till_enter() -> None:
import subprocess
from .constants import kitty_tool_exe
subprocess.Popen([kitty_tool_exe(), '__hold_till_enter__']).wait()
from .constants import kitten_exe
subprocess.Popen([kitten_exe(), '__hold_till_enter__']).wait()
def cleanup_ssh_control_masters() -> None:

View File

@ -15,12 +15,12 @@ from . import BaseTest
class TestBuild(BaseTest):
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()
self.assertTrue(os.access(exe, os.X_OK))
self.assertTrue(os.path.isfile(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.path.isfile(exe))
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
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)
self.assertTrue(is_executable(x), f'{x} is not executable')
if getattr(sys, 'frozen', False):

View File

@ -8,7 +8,7 @@ import shlex
import subprocess
import tempfile
from kitty.constants import kitty_tool_exe as kitty_tool
from kitty.constants import kitten_exe as kitten
from . import BaseTest
@ -86,10 +86,10 @@ def completion(self: TestCompletion, tdir: str):
env['HOME'] = os.path.join(tdir, 'sub')
env['KITTY_CONFIG_DIRECTORY'] = os.path.join(tdir, 'sub')
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
)
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)
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 --logo ', all_words('exe-not3.png'))
add('kitty @launch --logo ~', all_words('~/exe-not3.png'))
add('kitty-tool ', has_words('@'))
add('kitty-tool ', does_not_have_words('__complete__'))
add('kitty-tool @launch --ty', has_words('--type'))
add('kitten ', has_words('@'))
add('kitten ', does_not_have_words('__complete__'))
add('kitten @launch --ty', has_words('--type'))
add('kitty + ', has_words('launch', 'kitten'))
add('kitty + kitten ', has_words('icat', 'diff'))

View File

@ -143,7 +143,7 @@ copy --exclude */w.* d1
self.ae(contents, {
'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/bin/kitty-tool'
'.local/share/kitty-ssh-kitten/kitty/bin/kitten'
})
self.ae(len(glob.glob(f'{remote_home}/{tname}/*/xterm-kitty')), 2)

View File

@ -437,7 +437,7 @@ def files_for_upload() -> Dict[str, str]:
files[path] = desc
signatures[path] = f'GPG signature for {desc}'
b = len(files)
for path in glob.glob('build/static/kitty-tool-*'):
for path in glob.glob('build/static/kitten-*'):
if path.endswith('.sig'):
continue
path = os.path.abspath(path)

View File

@ -896,7 +896,7 @@ def update_go_generated_files(args: Options, kitty_exe: str) -> None:
raise SystemExit(cp.returncode)
def build_kitty_tool(
def build_static_kittens(
args: Options, launcher_dir: str, destination_dir: str = '', for_freeze: bool = False,
for_platform: Optional[Tuple[str, str]] = None
) -> str:
@ -917,7 +917,7 @@ def build_kitty_tool(
ld_flags.append('-s')
ld_flags.append('-w')
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:
dest += f'-{for_platform[0]}-{for_platform[1]}'
src = os.path.abspath('tools/cmd')
@ -957,8 +957,8 @@ def build_static_binaries(args: Options, launcher_dir: str) -> None:
'dragonfly': ('amd64',),
}.items():
for arch in arches_:
print('Cross compiling static kitty-tool for:', os_, arch)
build_kitty_tool(args, launcher_dir, args.dir_for_static_binaries, for_platform=(os_, arch))
print('Cross compiling static kitten for:', 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:
@ -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:
f.write(macos_info_plist())
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)
with suppress(FileNotFoundError):
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)
create_macos_app_icon(os.path.join(ddir, 'Contents', 'Resources'))
if not for_freeze:
kitty_tool_exe = build_kitty_tool(args, launcher_dir=os.path.dirname(kitty_exe))
os.symlink(os.path.relpath(kitty_tool_exe, os.path.dirname(in_src_launcher)),
os.path.join(os.path.dirname(in_src_launcher), os.path.basename(kitty_tool_exe)))
kitten_exe = build_static_kittens(args, launcher_dir=os.path.dirname(kitty_exe))
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(kitten_exe)))
return str(kitty_exe)
@ -1457,7 +1457,7 @@ def package(args: Options, bundle_type: str) -> None:
if path.endswith('.so'):
return True
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 False
@ -1466,7 +1466,7 @@ def package(args: Options, bundle_type: str) -> None:
path = os.path.join(root, f_)
os.chmod(path, 0o755 if should_be_executable(path) else 0o644)
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:
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:
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):
shutil.rmtree(x)
else:
@ -1566,7 +1566,7 @@ def option_parser() -> argparse.ArgumentParser: # {{{
p.add_argument(
'--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(
'--full',
@ -1737,17 +1737,17 @@ def main() -> None:
create_minimal_macos_bundle(args, launcher_dir)
else:
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':
init_env_from_args(args, False)
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':
init_env_from_args(args, False)
bundle_type = ('macos' if is_macos else 'linux') + '-freeze'
build_launcher(args, launcher_dir=os.path.join(args.prefix, 'bin'), bundle_type=bundle_type)
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':
build(args, native_optimizations=False)
package(args, bundle_type='linux-package')

View File

@ -209,14 +209,14 @@ _ksi_main() {
_ksi_prompt[ps0]+="\[\e]133;C\a\]"
fi
alias edit-in-kitty="kitty-tool edit-in-kitty"
alias edit-in-kitty="kitten edit-in-kitty"
if [[ "${_ksi_prompt[complete]}" == "y" ]]; then
_ksi_completions() {
builtin local src
builtin local limit
# Send all words up to the word the cursor is currently on
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
builtin eval "${src}"
fi
@ -224,7 +224,7 @@ _ksi_main() {
builtin complete -F _ksi_completions kitty
builtin complete -F _ksi_completions edit-in-kitty
builtin complete -F _ksi_completions clone-in-kitty
builtin complete -F _ksi_completions kitty-tool
builtin complete -F _ksi_completions kitten
fi
# wrap our prompt additions in markers we can use to remove them using

View File

@ -1,7 +1,7 @@
function __ksi_completions
set --local ct (commandline --current-token)
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
complete -f -c clone-in-kitty -a "(__ksi_completions)"

View File

@ -1,7 +1,7 @@
function __ksi_completions
set --local ct (commandline --current-token)
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
complete -f -c kitty-tool -a "(__ksi_completions)"
complete -f -c kitten -a "(__ksi_completions)"

View File

@ -1,7 +1,7 @@
function __ksi_completions
set --local ct (commandline --current-token)
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
complete -f -c kitty -a "(__ksi_completions)"

View File

@ -156,8 +156,8 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
end
end
function edit-in-kitty --wraps "kitty-tool edit-in-kitty"
kitty-tool edit-in-kitty $argv
function edit-in-kitty --wraps "kitten edit-in-kitty"
kitten edit-in-kitty $argv
end
function __ksi_transmit_data -d "Transmit data to kitty using chunked DCS escapes"

View File

@ -18,14 +18,14 @@ script_path="$(command readlink -f "$0" 2> /dev/null)"
script_dir="$(command dirname "$script_path")"
install_dir="$(command dirname "$script_dir")/install-tool"
remote_kitty_version_file="$script_dir/../version"
local_kitty_version_file="$install_dir/installed-kitty-tool-version"
kitty_exe="$install_dir/kitty-tool"
local_kitty_version_file="$install_dir/installed-kitten-version"
kitty_exe="$install_dir/kitten"
local_kitty_version=""
[ -f "$kitty_exe" -a -x "$kitty_exe" ] && exec_kitty "$@"
# Use kitty-tool from the downloaded kitty installation, if available.
embed_exe="$(command dirname "$script_dir")/install/bin/kitty-tool"
# Use kitten from the downloaded kitty installation, if available.
embed_exe="$(command dirname "$script_dir")/install/bin/kitten"
[ -f "$embed_exe" -a -x "$embed_exe" ] && {
kitty_exe="$embed_exe"
exec_kitty "$@"
@ -38,7 +38,7 @@ case "$(command uname)" in
'NetBSD') OS="netbsd";;
'OpenBSD') OS="openbsd";;
'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
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"
}
else
die "Neither curl nor wget available, cannot download kitty-tool"
die "Neither curl nor wget available, cannot download kitten"
fi
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"
# no kitty-tool available till 0.27.0
# no kitten available till 0.27.0
case "$release_version" in
v0.26.*) release_version="nightly";;
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"
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")"
fetch "$url" > "$download_dest" || {
command rm -f "$download_dest"
die "Failed to download kitty-tool"
die "Failed to download kitten"
}
command chmod 755 "$download_dest"
command mv "$download_dest" "$kitty_exe"

View File

@ -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")" ")" && {
if [ "$1" = "+kitten" ]; then shift "1"; else shift "2"; fi
exec kitty-tool "$@"
exec kitten "$@"
}
lock_dir=""

View File

@ -3,5 +3,5 @@
(( ${+commands[kitty]} )) || builtin return
builtin local src cmd=${(F)words:0:$CURRENT}
# 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"

View File

@ -107,7 +107,7 @@ _ksi_deferred_init() {
builtin autoload -Uz -- $comp_dir/_kitty
compdef _kitty kitty
compdef _kitty clone-in-kitty
compdef _kitty kitty-tool
compdef _kitty kitten
fi
# If compdef is not set, compinit has not run yet. In this case we must
@ -386,7 +386,7 @@ _ksi_deferred_init() {
fi
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
# of answering questions about it.

View File

@ -161,13 +161,13 @@ func exec_command(at_root_command *cli.Command, rl *readline.Readline, cmdline s
}
exe, err := os.Executable()
if err != nil {
exe, err = exec.LookPath("kitty-tool")
exe, err = exec.LookPath("kitten")
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
}
}
cmdline := []string{"kitty-tool", "@"}
cmdline := []string{"kitten", "@"}
cmdline = append(cmdline, parsed_cmdline...)
cmd := exec.Cmd{Path: exe, Args: cmdline, Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr}
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) {
const prefix = "kitty-tool @ "
const prefix = "kitten @ "
text := prefix + before_cursor
argv, position_of_last_arg := shlex.SplitForCompletion(text)
if len(argv) == 0 || position_of_last_arg < len(prefix) {
return
}
root := cli.NewRootCommand()
c := root.AddSubCommand(&cli.Command{Name: "kitty-tool"})
c := root.AddSubCommand(&cli.Command{Name: "kitten"})
EntryPoint(c)
root.Validate()
ans = root.GetCompletions(argv, nil)

View File

@ -10,7 +10,7 @@ import (
func main() {
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.Run = func(cmd *cli.Command, args []string) (int, error) {
cmd.ShowHelp()

View File

@ -27,14 +27,14 @@ func update_self(version string) (err error) {
exe := ""
exe, err = os.Executable()
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)
if err != nil {
return err
}
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
if version == "nightly" {
@ -44,8 +44,8 @@ func update_self(version string) (err error) {
if version == "latest" {
url_base = "https://github.com/kovidgoyal/kitty/releases/latest/download"
}
url := fmt.Sprintf("%s/kitty-tool-%s-%s", url_base, runtime.GOOS, runtime.GOARCH)
dest, err := os.CreateTemp(filepath.Dir(exe), "kitty-tool.")
url := fmt.Sprintf("%s/kitten-%s-%s", url_base, runtime.GOOS, runtime.GOARCH)
dest, err := os.CreateTemp(filepath.Dir(exe), "kitten.")
if err != nil {
return err
}
@ -65,15 +65,15 @@ func update_self(version string) (err error) {
}
}
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 {
sc := root.AddSubCommand(&cli.Command{
Name: "update-self",
Usage: "update-self [options ...]",
ShortDescription: "Update this kitty-tool binary",
HelpText: "Update this kitty-tool binary in place to the latest available version.",
ShortDescription: "Update this kitten binary",
HelpText: "Update this kitten binary in place to the latest available version.",
Run: func(cmd *cli.Command, args []string) (ret int, err error) {
if len(args) != 0 {
return 1, fmt.Errorf("No command line arguments are allowed")