Documentation ¶
Index ¶
- Constants
- type Command
- type CommandInfo
- type Session
- func (s *Session) Add(path string, promptCmd string) error
- func (s *Session) CheckForHistory() error
- func (s *Session) PrintLastCommand() error
- func (s *Session) Prune(path string) error
- func (s *Session) ResetLastCommand() error
- func (s *Session) ResultsDirectory(path string) ([]*Command, error)
- func (s *Session) ResultsGlobal() ([]*Command, error)
- func (s *Session) StoreLastCommand(line string) error
Constants ¶
const (
// Version is semantic version for package r and cmd/r
Version = "0.4.4"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Name string Info *CommandInfo }
Command struct stores the name and CommandInfo for each shell command stored in the r database
type CommandInfo ¶
CommandInfo struct is stored as the value to commands
func (*CommandInfo) NewFromString ¶
func (ci *CommandInfo) NewFromString(ciString string) *CommandInfo
NewFromString creates a new CommandInfo struct from a string
func (*CommandInfo) String ¶
func (ci *CommandInfo) String() string
func (*CommandInfo) Update ¶
func (ci *CommandInfo) Update(ciString string)
Update method will update the time and count of CommandInfo
type Session ¶
type Session struct { // Path to store and reference boltdb BoltPath string // Used to store the bool value from the r cmd global flag Global bool // SortUsagePtr used to check if the usage flag was used SortUsage bool // SortTimePtr used to check if the time flag was used SortTime bool }
Session is created every time r cmd is ran
func (*Session) Add ¶
Add checks if command being passed is in the listCommands then stores the command and workding directory
func (*Session) CheckForHistory ¶
CheckForHistory makes sure a directory has history or if the global bool is true it will make sure the global bucket has a history
func (*Session) PrintLastCommand ¶
PrintLastCommand is used with the r cli --command flag it shows the last command selected from the readline prompt
func (*Session) ResetLastCommand ¶
ResetLastCommand clears the value in the lastCommandBucket
func (*Session) ResultsDirectory ¶
ResultsDirectory reads the boltdb and returns the command history based on your current working directory
func (*Session) ResultsGlobal ¶
ResultsGlobal returns all the results for the global commands bucket
func (*Session) StoreLastCommand ¶
StoreLastCommand takes the line string and stores it