mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 06:25:13 +02:00
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:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user