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 CommitOnlyInCurrentBranch(branch, commitId string) bool
- 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 GetLastCommitId() string
- 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) repeat := strings.ToLower(os.Getenv("BIT_INTERACTIVE")) == "true" repeatAmount := 1 if repeat { repeatAmount = 5000 } for i := repeatAmount; i > 0; i-- { 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() continue } if bitCmdMap[subCommand] == nil { yes := HijackGitCommandOccurred(parsedArgs, suggestionTree, cmd.Version) if yes { continue } RunGitCommandWithArgs(parsedArgs) continue } 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 AddCommandToShellHistory ¶ added in v0.3.13
func AllBitAndGitSubCommands ¶ added in v0.3.13
func AllBitSubCommands ¶ added in v0.3.13
func AllGitAliases ¶ added in v0.3.14
func AllGitSubCommands ¶ added in v0.3.13
func AllGitSubCommands() map[string]*complete.CompTree
func AskConfirm ¶ added in v0.4.9
func AskMultiLine ¶ added in v0.6.2
func Bitcomplete ¶ added in v0.8.5
func Bitcomplete()
func BranchListSuggestions ¶ added in v0.3.13
func BranchListSuggestions() []complete.Suggestion
func CloudBranchExists ¶ added in v0.3.13
func CloudBranchExists() bool
func CobraCommandToDesc ¶ added in v0.9.14
func CobraCommandToName ¶ added in v0.9.14
func CobraCommandToSuggestions ¶ added in v0.3.13
func CommitOnlyInCurrentBranch ¶ added in v1.1.2
CommitOnlyInCurrentBranch Useful for verifying that a commit is only in one branch so that it's not risky to amend it
func CommonCommandsList ¶ added in v0.3.14
func CreateSuggestionMap ¶ added in v0.4.17
func CurrentBranch ¶ added in v0.3.13
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 FlagSuggestionsForCommand ¶ added in v0.3.13
func GHCliExistsAndLoggedIn ¶ added in v0.8.0
func GHCliExistsAndLoggedIn() bool
func GenBumpedSemVersion ¶ added in v0.3.13
func GetLastCommitId ¶ added in v1.1.2
func GetLastCommitId() string
func GetVersion ¶ added in v0.8.1
func GetVersion() string
func GitAddSuggestions ¶ added in v0.3.13
func GitAddSuggestions() []complete.Suggestion
func GitHubPRSuggestions ¶ added in v0.8.0
func GitResetSuggestions ¶ added in v0.3.16
func GitResetSuggestions() []prompt.Suggest
func GitmojiSuggestions ¶ added in v0.9.12
func GitmojiSuggestions() []complete.Suggestion
func HandleExit ¶ added in v0.4.4
func HandleExit()
func HijackGitCommandOccurred ¶ added in v0.9.2
func IsAheadOfCurrent ¶ added in v0.3.13
func IsAheadOfCurrent() bool
func IsBehindCurrent ¶ added in v0.3.13
func IsBehindCurrent() bool
func IsDiverged ¶ added in v0.3.13
func IsDiverged() bool
func MostRecentCommonAncestorCommit ¶ added in v0.3.17
func NothingToCommit ¶ added in v0.3.13
func NothingToCommit() bool
func PrintGitVersion ¶ added in v0.6.6
func PrintGitVersion()
func RunGitCommandWithArgs ¶ added in v0.4.1
func RunGitCommandWithArgs(args []string)
func RunInTerminalWithColor ¶ added in v0.4.1
func RunInTerminalWithColorInDir ¶ added in v0.4.14
func RunScriptWithString ¶ added in v0.3.13
func StashableChanges ¶ added in v0.3.13
func StashableChanges() bool
func SuggestionPrompt ¶ added in v0.3.13
Types ¶
type Branch ¶ added in v0.3.13
func BranchList ¶ added in v0.3.13
func BranchList() []*Branch
type FileChange ¶ added in v0.3.13
func FileChangesList ¶ added in v0.3.13
func FileChangesList() []FileChange
type PromptTheme ¶ added in v0.8.2
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 ¶ added in v0.8.0
func ListGHPullRequests ¶ added in v0.8.0
func ListGHPullRequests() []*PullRequest
Click to show internal directories.
Click to hide internal directories.