Documentation
¶
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 AllGitSubCommands() (cc []*cobra.Command)
- func BranchListSuggestions() []prompt.Suggest
- func CloudBranchExists() bool
- func CobraCommandToSuggestions(cmds []*cobra.Command) []prompt.Suggest
- func CurrentBranch() string
- func Execute()
- func FlagSuggestionsForCommand(gitSubCmd string, flagtype string) []prompt.Suggest
- func GenBumpedSemVersion() string
- func GitAddSuggestions() []prompt.Suggest
- func IsAheadOfCurrent() bool
- func IsBehindCurrent() bool
- func IsDiverged() bool
- func IsYes(resp string) bool
- func NothingToCommit() bool
- func PromptUser(prompt string) string
- func RunScriptWithString(path string, script string, args ...string)
- func Runwithcolor(cmdName string, args []string) error
- func StashList() []string
- func StashableChanges() bool
- func SuggestionPrompt(prefix string, completer func(d prompt.Document) []prompt.Suggest) string
- type Branch
- type FileChange
Constants ¶
This section is empty.
Variables ¶
View Source
var ShellCmd = &cobra.Command{ Use: "bit", Short: "Bit is Git with a simple interface. Plus you can still use all the old git commands", Long: `v0.3.11`, Run: func(cmd *cobra.Command, args []string) { _, bitCmdMap := AllBitSubCommands(cmd) allBitCmds := AllBitAndGitSubCommands(cmd) completerSuggestionMap := map[string][]prompt.Suggest{ "": {}, "shell": CobraCommandToSuggestions(allBitCmds), "checkout": BranchListSuggestions(), "switch": BranchListSuggestions(), "add": GitAddSuggestions(), "release": { {Text: "bump", Description: "Increment SemVer from tags and release"}, {Text: "<version>", Description: "Name of release version e.g. v0.1.2"}, }, } resp := SuggestionPrompt("bit ", shellCommandCompleter(completerSuggestionMap)) subCommand := resp if strings.Index(resp, " ") > 0 { subCommand = subCommand[0:strings.Index(resp, " ")] } if bitCmdMap[subCommand] == nil { parsedArgs, err := parseCommandLine(resp) if err != nil { fmt.Println(err) return } err = Runwithcolor("git", parsedArgs) if err != nil { fmt.Println("DEBUG: CMD may not be allow listed") } return } parsedArgs, err := parseCommandLine(resp) if err != nil { fmt.Println(err) return } cmd.SetArgs(parsedArgs) cmd.Execute() }, }
ShellCmd represents the base command when called without any subcommands
Functions ¶
func AddCommandToShellHistory ¶ added in v0.3.13
func AllBitAndGitSubCommands ¶ added in v0.3.13
func AllBitSubCommands ¶ added in v0.3.13
func AllGitSubCommands ¶ added in v0.3.13
func BranchListSuggestions ¶ added in v0.3.13
func CloudBranchExists ¶ added in v0.3.13
func CloudBranchExists() bool
func CobraCommandToSuggestions ¶ added in v0.3.13
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 ShellCmd.
func FlagSuggestionsForCommand ¶ added in v0.3.13
func GenBumpedSemVersion ¶ added in v0.3.13
func GenBumpedSemVersion() string
func GitAddSuggestions ¶ added in v0.3.13
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 NothingToCommit ¶ added in v0.3.13
func NothingToCommit() bool
func PromptUser ¶ added in v0.3.13
fixme when writing input the user cant backspace in the normal fashion
func RunScriptWithString ¶ added in v0.3.13
func Runwithcolor ¶ added in v0.3.13
func StashableChanges ¶ added in v0.3.13
func StashableChanges() bool
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
Click to show internal directories.
Click to hide internal directories.