Documentation
Overview ¶
Package main is complete tool for the go command line
Index ¶
- Variables
- func AddCommandToShellHistory(cmd string, args []string)
- func AllBitAndGitSubCommands(rootCmd *cobra.Command) (cc []*cobra.Command)
- func AllBitSubCommands(rootCmd *cobra.Command) ([]*cobra.Command, map[string]*cobra.Command)
- func AllGitAliases() (cc []*cobra.Command)
- func AllGitSubCommands() map[string]*complete.CompTree
- func AskConfirm(q string) bool
- func AskMultiLine(q string) string
- func Bitcomplete()
- func BranchListSuggestions() []complete.Suggestion
- func CloudBranchExists() bool
- func CobraCommandToDesc(cmds []*cobra.Command) []string
- func CobraCommandToName(cmds []*cobra.Command) []string
- func CobraCommandToSuggestions(cmds []*cobra.Command) []prompt.Suggest
- func CommonCommandsList() []*cobra.Command
- func CreateSuggestionMap(cmd *cobra.Command) (*complete.CompTree, map[string]*cobra.Command)
- func CurrentBranch() string
- func Execute()
- func Find(slice []string, val string) int
- func FlagSuggestionsForCommand(gitSubCmd string, flagtype string) []prompt.Suggest
- func GHCliExistsAndLoggedIn() bool
- func GenBumpedSemVersion(out string) (string, error)
- func GetVersion() string
- func GitAddSuggestions() []complete.Suggestion
- func GitHubPRSuggestions(prefix string) func(prefix string) []complete.Suggestion
- func GitResetSuggestions() []prompt.Suggest
- func GitmojiSuggestions() []complete.Suggestion
- func HandleExit()
- func HijackGitCommandOccurred(args []string, suggestionMap *complete.CompTree, version string) bool
- func IsAheadOfCurrent() bool
- func IsBehindCurrent() bool
- func IsDiverged() bool
- func IsGitRepo() bool
- func MostRecentCommonAncestorCommit(branchA, branchB string) string
- func NothingToCommit() bool
- func PrintGitVersion()
- func RunGitCommandWithArgs(args []string)
- func RunInTerminalWithColor(cmdName string, args []string) error
- func RunInTerminalWithColorInDir(cmdName string, dir string, args []string) error
- func RunScriptWithString(path string, script string, args ...string)
- func StashList() []string
- func StashableChanges() bool
- func SuggestionPrompt(prefix string, completer func(d prompt.Document) []prompt.Suggest) string
- type Branch
- type Exit
- type FileChange
- type Gitmoji
- type PromptTheme
- type PullRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var BitCmd = &cobra.Command{ Use: "bit", Short: "Bit is a Git CLI that predicts what you want to do", Long: ``, Run: func(cmd *cobra.Command, args []string) { suggestionTree, bitCmdMap := CreateSuggestionMap(cmd) resp := SuggestionPrompt("> bit ", shellCommandCompleter(suggestionTree)) subCommand := resp if subCommand == "" { return } if strings.Index(resp, " ") > 0 { subCommand = subCommand[0:strings.Index(resp, " ")] } parsedArgs, err := parseCommandLine(resp) if err != nil { log.Debug().Err(err).Send() return } if bitCmdMap[subCommand] == nil { yes := HijackGitCommandOccurred(parsedArgs, suggestionTree, cmd.Version) if yes { return } RunGitCommandWithArgs(parsedArgs) return } cmd.SetArgs(parsedArgs) cmd.Execute() }, }
BitCmd represents the base command when called without any subcommands
View Source
var DefaultTheme = PromptTheme{
PrefixTextColor: prompt.Yellow,
SelectedSuggestionBGColor: prompt.Yellow,
SuggestionBGColor: prompt.Yellow,
SuggestionTextColor: prompt.DarkGray,
SelectedSuggestionTextColor: prompt.Blue,
DescriptionBGColor: prompt.Black,
DescriptionTextColor: prompt.White,
}
View Source
var InvertedTheme = PromptTheme{
PrefixTextColor: prompt.Blue,
SelectedSuggestionBGColor: prompt.LightGray,
SelectedSuggestionTextColor: prompt.White,
SuggestionBGColor: prompt.Blue,
SuggestionTextColor: prompt.White,
DescriptionBGColor: prompt.LightGray,
DescriptionTextColor: prompt.Black,
}
View Source
var MonochromeTheme = PromptTheme{}
Functions ¶
func AllBitAndGitSubCommands ¶
func AllBitSubCommands ¶
func AllGitAliases ¶
func AllGitSubCommands ¶
func AskConfirm ¶
func AskMultiLine ¶
func Bitcomplete ¶
func Bitcomplete()
func BranchListSuggestions ¶
func BranchListSuggestions() []complete.Suggestion
func CloudBranchExists ¶
func CloudBranchExists() bool
func CobraCommandToDesc ¶
func CobraCommandToName ¶
func CommonCommandsList ¶
func CreateSuggestionMap ¶
func CurrentBranch ¶
func CurrentBranch() string
func Execute ¶
func Execute()
Execute adds all child commands to the shell command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the BitCmd.
func GHCliExistsAndLoggedIn ¶
func GHCliExistsAndLoggedIn() bool
func GenBumpedSemVersion ¶
func GetVersion ¶
func GetVersion() string
func GitAddSuggestions ¶
func GitAddSuggestions() []complete.Suggestion
func GitHubPRSuggestions ¶
func GitHubPRSuggestions(prefix string) func(prefix string) []complete.Suggestion
func GitResetSuggestions ¶
func GitResetSuggestions() []prompt.Suggest
func GitmojiSuggestions ¶
func GitmojiSuggestions() []complete.Suggestion
func HandleExit ¶
func HandleExit()
func IsAheadOfCurrent ¶
func IsAheadOfCurrent() bool
func IsBehindCurrent ¶
func IsBehindCurrent() bool
func IsDiverged ¶
func IsDiverged() bool
func NothingToCommit ¶
func NothingToCommit() bool
func PrintGitVersion ¶
func PrintGitVersion()
func RunGitCommandWithArgs ¶
func RunGitCommandWithArgs(args []string)
func RunInTerminalWithColor ¶
func RunScriptWithString ¶
func StashableChanges ¶
func StashableChanges() bool
func SuggestionPrompt ¶
Types ¶
type Branch ¶
func BranchList ¶
func BranchList() []*Branch
type FileChange ¶
func FileChangesList ¶
func FileChangesList() []FileChange
type PromptTheme ¶
type PromptTheme struct { PrefixTextColor prompt.Color SelectedSuggestionBGColor prompt.Color SuggestionBGColor prompt.Color SuggestionTextColor prompt.Color SelectedSuggestionTextColor prompt.Color DescriptionBGColor prompt.Color DescriptionTextColor prompt.Color }
type PullRequest ¶
func ListGHPullRequests ¶
func ListGHPullRequests() []*PullRequest