Skip to content

Commit

Permalink
Merge pull request #2595 from carapace-sh/selfupdate
Browse files Browse the repository at this point in the history
added selfupdate mechanism
  • Loading branch information
rsteube authored Nov 20, 2024
2 parents bfe27ae + 6efc268 commit 031e694
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

build:
runs-on: ubuntu-latest
container: ghcr.io/carapace-sh/go:1.23.0
container: ghcr.io/carapace-sh/go:1.23.1
steps:
- name: shallow clone
uses: actions/checkout@v4
Expand Down
7 changes: 7 additions & 0 deletions cmd/carapace/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ var rootCmd = &cobra.Command{
case "--run":
runCmd.SetArgs(args[1:])
runCmd.Execute()
case "--selfupdate":
selfupdateCmd.SetArgs(args[1:])
selfupdateCmd.Execute()
case "--schema":
schemaCmd.SetArgs(args[1:])
schemaCmd.Execute()
Expand Down Expand Up @@ -187,6 +190,7 @@ func init() {
rootCmd.Flags().Bool("list", false, "list completers")
rootCmd.Flags().Bool("macro", false, "list or execute macros")
rootCmd.Flags().Bool("run", false, "run spec")
rootCmd.Flags().Bool("selfupdate", false, "update to nightly/stable")
rootCmd.Flags().Bool("schema", false, "json schema for spec files")
rootCmd.Flags().Bool("style", false, "set style")
rootCmd.Flags().BoolP("version", "v", false, "version for carapace")
Expand All @@ -201,6 +205,7 @@ func init() {
"macro",
"run",
"schema",
"selfupdate",
"style",
"version",
)
Expand Down Expand Up @@ -238,6 +243,8 @@ func init() {
return carapace.ActionExecute(macroCmd).Shift(1)
case "--run":
return carapace.ActionExecute(runCmd).Shift(1)
case "--selfupdate":
return carapace.ActionExecute(selfupdateCmd).Shift(1)
case "--schema":
return carapace.ActionExecute(schemaCmd).Shift(1)
case "--style":
Expand Down
11 changes: 11 additions & 0 deletions cmd/carapace/cmd/selfupdate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package cmd

import (
selfupdate "github.com/carapace-sh/carapace-selfupdate"
)

var selfupdateCmd = selfupdate.Command(
"carapace-sh",
"carapace-bin",
selfupdate.WithBinary("carapace"),
)
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module github.com/carapace-sh/carapace-bin

go 1.23.0
go 1.23.1

require (
github.com/carapace-sh/carapace v1.5.0
github.com/carapace-sh/carapace-bridge v1.1.0
github.com/carapace-sh/carapace-selfupdate v0.0.3
github.com/carapace-sh/carapace-shlex v1.0.1
github.com/carapace-sh/carapace-spec v1.0.5
github.com/pelletier/go-toml v1.9.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ github.com/carapace-sh/carapace-bridge v1.1.0 h1:WkeQGPg7Zu0S3M39c0hZDlPY7EJ7Lro
github.com/carapace-sh/carapace-bridge v1.1.0/go.mod h1:bKG97KfwYewrvke7ULgv0OYIJ6lHbJDPex8W29NlD6o=
github.com/carapace-sh/carapace-pflag v1.0.0 h1:uJMhl+vwEM/Eb0UdxZUuv4jo4rUAyPijkRGP5gfCuCE=
github.com/carapace-sh/carapace-pflag v1.0.0/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/carapace-sh/carapace-selfupdate v0.0.3 h1:kgkrH5rsq/LchKInGRFf5WvoygHf98fMuMD1iCSBsbk=
github.com/carapace-sh/carapace-selfupdate v0.0.3/go.mod h1:gyvAPrYpUU6pCgH+Mox+LTotxCQmUTHl+u/g4j/H9aQ=
github.com/carapace-sh/carapace-shlex v1.0.1 h1:ww0JCgWpOVuqWG7k3724pJ18Lq8gh5pHQs9j3ojUs1c=
github.com/carapace-sh/carapace-shlex v1.0.1/go.mod h1:lJ4ZsdxytE0wHJ8Ta9S7Qq0XpjgjU0mdfCqiI2FHx7M=
github.com/carapace-sh/carapace-spec v1.0.5 h1:B9l+NIX2FFaFDSZjh2I5lRhM53UIRWYfoR+K3uN4nek=
Expand Down

0 comments on commit 031e694

Please sign in to comment.