Skip to content

Commit

Permalink
git: gui
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Apr 26, 2022
1 parent 25af053 commit 47c310e
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 19 deletions.
17 changes: 0 additions & 17 deletions completers/git_completer/cmd/gitk_generated.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package cmd

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

var guiCmd = &cobra.Command{
Use: "gui",
Short: "A portable graphical interface to Git",
Run: func(cmd *cobra.Command, args []string) {
},
Run: func(cmd *cobra.Command, args []string) {},
}

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

rootCmd.AddCommand(guiCmd)
}
31 changes: 31 additions & 0 deletions completers/git_completer/cmd/gui_blame.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

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

var gui_blameCmd = &cobra.Command{
Use: "blame",
Short: "Start a blame viewer on the specified file on the given version",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(gui_blameCmd).Standalone()
gui_blameCmd.Flags().String("line", "", "Loads annotations as described above and automatically scrolls the view")

guiCmd.AddCommand(gui_blameCmd)

carapace.Gen(gui_blameCmd).PositionalCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if util.HasPathPrefix(c.CallbackValue) {
return carapace.ActionFiles()
}
return git.ActionRefs(git.RefOptionDefault)
}),
carapace.ActionFiles(),
)
}
23 changes: 23 additions & 0 deletions completers/git_completer/cmd/gui_browser.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

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

var browserCmd = &cobra.Command{
Use: "browser",
Short: "Start a tree browser showing all files in the specified commit",
Run: func(cmd *cobra.Command, args []string) {},
}

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

guiCmd.AddCommand(browserCmd)

carapace.Gen(browserCmd).PositionalCompletion(
git.ActionRefs(git.RefOptionDefault),
)
}
20 changes: 20 additions & 0 deletions completers/git_completer/cmd/gui_citool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

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

var gui_citoolCmd = &cobra.Command{
Use: "citool",
Short: "Start git gui and arrange to make exactly one commit before exiting and returning to the shell",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(gui_citoolCmd).Standalone()
gui_citoolCmd.Flags().Bool("amend", false, "Automatically enter the Amend Last Commit mode of the interface")
gui_citoolCmd.Flags().Bool("nocommit", false, "Behave as normal citool, but instead of making a commit simply terminate with a zero exit code")

guiCmd.AddCommand(gui_citoolCmd)
}
18 changes: 18 additions & 0 deletions completers/git_completer/cmd/gui_version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

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

var gui_versionCmd = &cobra.Command{
Use: "version",
Short: "Display the currently running version of git gui",
Run: func(cmd *cobra.Command, args []string) {},
}

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

guiCmd.AddCommand(gui_versionCmd)
}

0 comments on commit 47c310e

Please sign in to comment.