add yang module prefix to xpath description
@@ -145,6 +145,7 @@ func initPromptFlags(cmd *cobra.Command) {
cmd.Flags().String("suggestions-bg-color", "dark_blue", "suggestion box background color")
cmd.Flags().String("description-bg-color", "dark_gray", "description box background color")
cmd.Flags().Bool("suggest-all-flags", false, "suggest local as well as inherited flags of subcommands")
+ cmd.Flags().Bool("description-with-prefix", false, "show YANG module prefix in XPATH suggestion description")
viper.BindPFlag("prompt-file", cmd.LocalFlags().Lookup("file"))
viper.BindPFlag("prompt-exclude", cmd.LocalFlags().Lookup("exclude"))
viper.BindPFlag("prompt-dir", cmd.LocalFlags().Lookup("dir"))
@@ -153,6 +154,7 @@ func initPromptFlags(cmd *cobra.Command) {
viper.BindPFlag("prompt-suggestions-bg-color", cmd.LocalFlags().Lookup("suggestions-bg-color"))
viper.BindPFlag("prompt-description-bg-color", cmd.LocalFlags().Lookup("description-bg-color"))
viper.BindPFlag("prompt-suggest-all-flags", cmd.LocalFlags().Lookup("suggest-all-flags"))
+ viper.BindPFlag("prompt-description-with-prefix", cmd.LocalFlags().Lookup("description-with-prefix"))
}
func findMatchedXPATH(entry *yang.Entry, word string, cursor int) []goprompt.Suggest {
@@ -231,6 +233,12 @@ func buildXPATHDescription(entry *yang.Entry) string {
}
sb.WriteString(getPermissions(entry))
sb.WriteString(" ")
+ if viper.GetBool("prompt-description-with-prefix") {
+ if entry.Prefix != nil {
+ sb.WriteString(entry.Prefix.Name)
+ sb.WriteString(": ")
+ }
+ }
sb.WriteString(entry.Description)
return sb.String()
}
