1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
// License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
package update_self
import (
"fmt"
"github.com/kovidgoyal/kitty/tools/cli"
)
type Options struct {
FetchVersion string
}
var update_self_disabled = "This option has been disabled in the Debian package since the releases are managed via the Debian archive. Please update the package via apt for latest kitten/kitty binary in the archive."
func update_self(version string) (err error) {
fmt.Println(update_self_disabled)
return nil
}
func EntryPoint(root *cli.Command) *cli.Command {
sc := root.AddSubCommand(&cli.Command{
Name: "update-self",
Usage: "[options]",
ShortDescription: "Update this kitten binary",
HelpText: update_self_disabled,
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")
}
opts := &Options{}
err = cmd.GetOptionValues(opts)
if err != nil {
return 1, err
}
return 0, update_self(opts.FetchVersion)
},
})
sc.Add(cli.OptionSpec{
Name: "--fetch-version",
Default: "latest",
Help: update_self_disabled,
})
return sc
}
|