Skip to content

Commit

Permalink
Merge pull request #1409 from rsteube/go-mod-edit-version
Browse files Browse the repository at this point in the history
go: mod edit - version completion
  • Loading branch information
rsteube authored Nov 13, 2022
2 parents 1c30110 + 1fd2946 commit ca79d01
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions completers/go_completer/cmd/mod_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func init() {
"dropreplace": golang.ActionModules(golang.ModuleOpts{Replace: true}),
"droprequire": golang.ActionModules(golang.ModuleOpts{Direct: true, IncludeVersion: false}),
"exclude": golang.ActionModuleSearch(),
"go": golang.ActionVersions(),
"module": carapace.ActionFiles(),
"replace": carapace.ActionMultiParts("=", func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/rsteube/carapace-bin

go 1.18
go 1.19

require (
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
Expand Down
35 changes: 35 additions & 0 deletions pkg/actions/tools/golang/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package golang

import (
"github.com/rsteube/carapace"
)

// ActionVersions completes go versions
//
// 1.18 (2022-03-15)
// 1.19 (2022-08-02)
func ActionVersions() carapace.Action {
// https://go.dev/doc/devel/release
return carapace.ActionValuesDescribed(
"1.19", "2022-08-02",
"1.18", "2022-03-15",
"1.17", "2021-08-16",
"1.16", "2021-02-16",
"1.15", "2020-08-11",
"1.14", "2020-02-25",
"1.13", "2019-09-03",
"1.12", "2019-02-25",
"1.11", "2018-08-24",
"1.10", "2018-02-16",
"1.9", "2017-08-24",
"1.8", "2017-02-16",
"1.7", "2016-08-15",
"1.6", "2016-02-17",
"1.5", "2015-08-19",
"1.4", "2014-12-10",
"1.3", "2014-06-18",
"1.2", "2013-12-01",
"1.1", "2013-05-13",
"1", "2012-03-28",
)
}

0 comments on commit ca79d01

Please sign in to comment.