Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added gh-copilot #2250

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions completers/gh-copilot_completer/cmd/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

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

var configCmd = &cobra.Command{
Use: "config",
Short: "Change configuration options, such as sending of optional analytics data",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(configCmd).Standalone()

configCmd.Flags().BoolP("help", "h", false, "help for config")
rootCmd.AddCommand(configCmd)
}
24 changes: 24 additions & 0 deletions completers/gh-copilot_completer/cmd/explain.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bridge/pkg/actions/bridge"
"github.com/spf13/cobra"
)

var explainCmd = &cobra.Command{
Use: "explain",
Short: "Explain a given input command in natural language",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(explainCmd).Standalone()

explainCmd.Flags().BoolP("help", "h", false, "help for explain")
rootCmd.AddCommand(explainCmd)

carapace.Gen(explainCmd).PositionalCompletion(
bridge.ActionCarapaceBin().SplitP(),
)
}
22 changes: 22 additions & 0 deletions completers/gh-copilot_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

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

var rootCmd = &cobra.Command{
Use: "gh-copilot",
Short: "Your AI command line copilot",
Run: func(cmd *cobra.Command, args []string) {},
}

func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().BoolP("help", "h", false, "help for copilot")
rootCmd.Flags().BoolP("version", "v", false, "version for copilot")
}
24 changes: 24 additions & 0 deletions completers/gh-copilot_completer/cmd/suggest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

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

var suggestCmd = &cobra.Command{
Use: "suggest",
Short: "Suggest a command based on a natural language description of the desired output effect",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(suggestCmd).Standalone()

suggestCmd.Flags().BoolP("help", "h", false, "help for suggest")
suggestCmd.Flags().StringP("target", "t", "", "Target for suggestion; must be shell, gh, git")
rootCmd.AddCommand(suggestCmd)

carapace.Gen(suggestCmd).FlagCompletion(carapace.ActionMap{
"target": carapace.ActionValues("shell", "gh", "git"),
})
}
7 changes: 7 additions & 0 deletions completers/gh-copilot_completer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/rsteube/carapace-bin/completers/gh-copilot_completer/cmd"

func main() {
cmd.Execute()
}
Loading