Skip to content

Commit

Permalink
Merge pull request #2309 from carapace-sh/git-browse
Browse files Browse the repository at this point in the history
added git-browse
  • Loading branch information
rsteube authored Mar 24, 2024
2 parents 2fa8731 + 5bce43f commit 791b846
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
29 changes: 29 additions & 0 deletions completers/git-browse_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/git"
"github.com/carapace-sh/carapace/pkg/traverse"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "git-browse",
Short: "Opens the current git repository website in your default web browser",
Long: "https://github.com/tj/git-extras/blob/master/Commands.md#git-browse",
Run: func(cmd *cobra.Command, args []string) {},
}

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

rootCmd.Flags().Bool("help", false, "show help")

carapace.Gen(rootCmd).PositionalCompletion(
git.ActionRemotes(),
carapace.ActionFiles().ChdirF(traverse.GitWorkTree),
)
}
7 changes: 7 additions & 0 deletions completers/git-browse_completer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/carapace-sh/carapace-bin/completers/git-browse_completer/cmd"

func main() {
cmd.Execute()
}

0 comments on commit 791b846

Please sign in to comment.