本文整理匯總了Golang中cmd/internal/pprof/plugin.UI.SetAutoComplete方法的典型用法代碼示例。如果您正苦於以下問題:Golang UI.SetAutoComplete方法的具體用法?Golang UI.SetAutoComplete怎麽用?Golang UI.SetAutoComplete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cmd/internal/pprof/plugin.UI
的用法示例。
在下文中一共展示了UI.SetAutoComplete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: interactive
// interactive displays a prompt and reads commands for profile
// manipulation/visualization.
func interactive(p *profile.Profile, obj plugin.ObjTool, ui plugin.UI, f *flags) error {
updateAutoComplete(p)
// Enter command processing loop.
ui.Print("Entering interactive mode (type \"help\" for commands)")
ui.SetAutoComplete(commands.NewCompleter(f.commands))
for {
input, err := readCommand(p, ui, f)
if err != nil {
if err != io.EOF {
return err
}
if input == "" {
return nil
}
}
// Process simple commands.
switch input {
case "":
continue
case ":":
f.flagFocus = newString("")
f.flagIgnore = newString("")
f.flagTagFocus = newString("")
f.flagTagIgnore = newString("")
f.flagHide = newString("")
continue
}
fields := splitCommand(input)
// Process report generation commands.
if _, ok := f.commands[fields[0]]; ok {
if err := generateReport(p, fields, obj, ui, f); err != nil {
if err == io.EOF {
return nil
}
ui.PrintErr(err)
}
continue
}
switch cmd := fields[0]; cmd {
case "help":
commandHelp(fields, ui, f)
continue
case "exit", "quit":
return nil
}
// Process option settings.
if of, err := optFlags(p, input, f); err == nil {
f = of
} else {
ui.PrintErr("Error: ", err.Error())
}
}
}