Documentation ¶
Index ¶
- Variables
- func AddCMDHistory(c Context, cmd string)
- func FindPromptActionExecutor[T PromptExecutor](actions []PromptAction) *T
- func GetHomeFilePath(file string) string
- func GetHomeWorkspaceFilePath(workspaceName, file string) string
- func GetHomeWorkspacePath(workspaceName string) string
- func HasRightToExecute(p PromptAction, in []string, role string) bool
- type CMDHistories
- type CMDHistory
- type Context
- func (c *Context) AddCollectionHistoryRequest(i postman.CollectionHistoryItem)
- func (c *Context) Clean()
- func (c *Context) GetCMDHistoryPath() string
- func (c *Context) GetCollectionHistoryPath() string
- func (c *Context) GetCollectionPath() string
- func (c *Context) GetEnvName() string
- func (c *Context) GetEnvPath(env postman.Env) string
- func (c *Context) GetWorkspacePath() string
- type Option
- type ParamWithRole
- type PromptAction
- type PromptCallback
- type PromptExecutor
- type PromptSuggestCallback
Constants ¶
This section is empty.
Variables ¶
View Source
var APP_MODE = "user"
View Source
var FILE_LOG = ""
View Source
var GCLI_4POSTMAN_HOME = os.Getenv("GCLI_4POSTMAN_HOME")
View Source
var HTTP_BODY_SIZE_LIMIT = 5000
View Source
var SECRET = ""
Functions ¶
func AddCMDHistory ¶
AddCMDHistory historises the command {cmd} (writes data on the disk).
func FindPromptActionExecutor ¶
func FindPromptActionExecutor[T PromptExecutor](actions []PromptAction) *T
FindPromptActionExecutor finds the prompt action executor {T}.
func GetHomeFilePath ¶
func GetHomeWorkspacePath ¶
func HasRightToExecute ¶
func HasRightToExecute(p PromptAction, in []string, role string) bool
HasRightToExecute checks if the prompt action {p} can be executed based on user input and current mode.
Types ¶
type CMDHistories ¶
type CMDHistories []CMDHistory
func (CMDHistories) GetName ¶
func (s CMDHistories) GetName() []string
GetName returns the CMD history
type CMDHistory ¶
func NewCMDHistory ¶
func NewCMDHistory(cmd string) CMDHistory
type Context ¶
type Context struct { WorkspaceName string CollectionName string Collection *postman.Collection Env *postman.Env Envs []postman.Env CollectionHistoryRequests postman.CollectionHistoryItems CMDsHistory CMDHistories Log logger.Logger Print func(string, string, ...any) }
func (*Context) AddCollectionHistoryRequest ¶
func (c *Context) AddCollectionHistoryRequest(i postman.CollectionHistoryItem)
func (*Context) GetCMDHistoryPath ¶
func (*Context) GetCollectionHistoryPath ¶
func (*Context) GetCollectionPath ¶
func (*Context) GetEnvName ¶
func (*Context) GetWorkspacePath ¶
type ParamWithRole ¶
type PromptAction ¶
type PromptAction interface { // GetName returns the name of the action GetName() string // GetDescription returns the action's description (for "help" cmd) GetDescription(markdown bool) string // GetOptions returns the action's options can be used (for "help" cmd) GetOptions(markdown bool) []Option // GetActionKeys returns the command(s) (load, :l) which should used to use this prompt action GetActionKeys() []string // GetParamKeys returns the param(s) (-update-readme, -secure-mode) which should used to use this prompt action GetParamKeys() []ParamWithRole // GetPromptExecutor builds the action's executor used to execute commands GetPromptExecutor() PromptExecutor // PromptSuggest returns the action's suggests available PromptSuggest(in []string, d prompt.Document) ([]prompt.Suggest, error) // PromptExecutor executes action's command and can return a callback PromptExecutor(in []string) *PromptCallback // PromptCallback executes command after callback - often used to have user confirmation PromptCallback(in []string, actions []PromptAction, args ...any) }
PromptAction interface which defines how to implement a new prompt action
type PromptCallback ¶
type PromptCallback struct { Text string Callbacks []PromptSuggestCallback PromptAction PromptAction Args []any }
func NewPromptCallback ¶
func NewPromptCallback(text string, callbacks []PromptSuggestCallback, promptAction PromptAction, args ...any) *PromptCallback
func (PromptCallback) Callback ¶
func (p PromptCallback) Callback(in []string, actions []PromptAction)
func (PromptCallback) GetSuggests ¶
func (p PromptCallback) GetSuggests() []prompt.Suggest
func (PromptCallback) IsAvailableAnswer ¶
func (p PromptCallback) IsAvailableAnswer(in string) bool
type PromptExecutor ¶
type PromptExecutor interface{}
type PromptSuggestCallback ¶
func NewPromptSuggestCallback ¶
func NewPromptSuggestCallback(text string, desc string) PromptSuggestCallback
Source Files ¶
Click to show internal directories.
Click to hide internal directories.