printer: doc for exported symbols

Updates #9
This commit is contained in:
Michael McLoughlin
2019-01-04 19:03:02 -08:00
parent cfce8d94df
commit 88eff53893
4 changed files with 51 additions and 2 deletions

31
printer/printer_test.go Normal file
View File

@@ -0,0 +1,31 @@
package printer_test
import (
"fmt"
"github.com/mmcloughlin/avo/printer"
)
func ExampleConfig_GeneratedWarning() {
// Default configuration named "avo".
cfg := printer.NewDefaultConfig()
fmt.Println(cfg.GeneratedWarning())
// Name can be customized.
cfg = printer.Config{
Name: "mildred",
}
fmt.Println(cfg.GeneratedWarning())
// Argv takes precedence.
cfg = printer.Config{
Argv: []string{"echo", "hello", "world"},
Name: "mildred",
}
fmt.Println(cfg.GeneratedWarning())
// Output:
// Code generated by avo. DO NOT EDIT.
// Code generated by mildred. DO NOT EDIT.
// Code generated by command: echo hello world. DO NOT EDIT.
}