(p ast.PredicateSym)
| 121 | } |
| 122 | |
| 123 | func (i *Interpreter) showPredicate(p ast.PredicateSym) { |
| 124 | const docStringMargin = 50 |
| 125 | decl := i.knownPredicates[p] |
| 126 | atomText := decl.DeclaredAtom.DisplayString() |
| 127 | if docLines := decl.Doc(); len(docLines) != 0 && docLines[0] != "" { |
| 128 | prefixLen := 0 |
| 129 | if len(atomText) < docStringMargin { |
| 130 | prefixLen = len(atomText) |
| 131 | } |
| 132 | spacer := strings.Repeat(" ", docStringMargin-prefixLen) |
| 133 | if len(atomText) < docStringMargin { |
| 134 | fmt.Fprintf(i.out, "%s%s%s\n", atomText, spacer, docLines[0]) |
| 135 | } else { |
| 136 | fmt.Fprintf(i.out, "%s\n%s%s\n", atomText, spacer, docLines[0]) |
| 137 | } |
| 138 | } else { |
| 139 | fmt.Fprintf(i.out, "%s\n", atomText) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // Show shows information about predicates. |
| 144 | // If arg = "all", it lists all predicate. |
no test coverage detected