15
15
// protodoc generates Protocol Buffer documentation.
16
16
//
17
17
// Usage:
18
- // protodoc [flags]
18
+ // protodoc [flags]
19
19
//
20
20
// Flags:
21
- // --directories value comma separated map of target directory to parse options (e.g. 'dirA=message,dirB=message_service')
22
- // -d, --directory string target directory where Protocol Buffer files are.
23
- // -h, --help help for protodoc
24
- // -l, --languages value language options in field descriptions (Go, C++, Java, Python, Ruby, C#) (default [])
25
- // --message-only-from-this-file string if specified, it parses only the messages in this file within the directory
26
- // -o, --output string output file path to save documentation
27
- // -p, --parse value Protocol Buffer types to parse (message, service) (default [service,message])
28
- // -t, --title string title of documentation
21
+ // --directories=: comma separated map of target directory to parse options (e.g. 'dirA=message,dirB=message_service')
22
+ // -d, --directory="": target directory where Protocol Buffer files are.
23
+ // -c, --disclaimer="": disclaimer statement
24
+ // -h, --help[=false]: help for protodoc
25
+ // -l, --languages=[]: language options in field descriptions (Go, C++, Java, Python, Ruby, C#)
26
+ // --message-only-from-this-file="": if specified, it parses only the messages in this file within the directory
27
+ // -o, --output="": output file path to save documentation
28
+ // -p, --parse=[service,message]: Protocol Buffer types to parse (message, service)
29
+ // -t, --title="": title of documentation
29
30
//
30
31
package main
31
32
52
53
languageOptions []string
53
54
title string
54
55
outputPath string
56
+ disclaimer string
55
57
56
58
targetDirectories = newDirectoryOptions ()
57
59
messageOnlyFromThisFile string
@@ -106,6 +108,7 @@ func init() {
106
108
rootCommand .PersistentFlags ().StringSliceVarP (& languageOptions , "languages" , "l" , []string {}, "language options in field descriptions (Go, C++, Java, Python, Ruby, C#)" )
107
109
rootCommand .PersistentFlags ().StringVarP (& title , "title" , "t" , "" , "title of documentation" )
108
110
rootCommand .PersistentFlags ().StringVarP (& outputPath , "output" , "o" , "" , "output file path to save documentation" )
111
+ rootCommand .PersistentFlags ().StringVarP (& disclaimer , "disclaimer" , "c" , "" , "disclaimer statement" )
109
112
110
113
rootCommand .PersistentFlags ().Var (& targetDirectories , "directories" , "comma separated map of target directory to parse options (e.g. 'dirA=message,dirB=message_service')" )
111
114
rootCommand .PersistentFlags ().StringVar (& messageOnlyFromThisFile , "message-only-from-this-file" , "" , "if specified, it parses only the messages in this file within the directory" )
@@ -129,7 +132,7 @@ func CommandFunc(cmd *cobra.Command, args []string) error {
129
132
}
130
133
}
131
134
log .Println ("converting to markdown" , title )
132
- rs , err = proto .Markdown (title , opts , languageOptions ... )
135
+ rs , err = proto .Markdown (disclaimer , title , opts , languageOptions ... )
133
136
if err != nil {
134
137
return err
135
138
}
@@ -147,7 +150,7 @@ func CommandFunc(cmd *cobra.Command, args []string) error {
147
150
if err != nil {
148
151
return err
149
152
}
150
- ms , err := proto .Markdown ("" , elem .options , languageOptions ... )
153
+ ms , err := proto .Markdown (disclaimer , "" , elem .options , languageOptions ... )
151
154
if err != nil {
152
155
return err
153
156
}
0 commit comments