|
16 | 16 | option '--markup FORMAT' do |
17 | 17 | summary "The markup format to use for docstring text (defaults to 'markdown')." |
18 | 18 | end |
| 19 | + option '--emit-json-stdout' do |
| 20 | + summary 'DEPRECATED: Print JSON representation of the documentation to stdout.' |
| 21 | + end |
| 22 | + option '--emit-json PATH' do |
| 23 | + summary 'DEPRECATED: Write JSON representation of the documentation to the given file.' |
| 24 | + end |
19 | 25 |
|
20 | 26 | summary 'Generate documentation from files.' |
21 | 27 | arguments '[[search_pattern] ...]' |
@@ -94,14 +100,20 @@ def build_generate_options(options = nil, *yard_args) |
94 | 100 | generate_options[:yard_args] = yard_args unless yard_args.empty? |
95 | 101 |
|
96 | 102 | if options |
| 103 | + if options[:emit_json] |
| 104 | + $stderr.puts "WARNING: '--emit-json PATH' is deprecated. Use '--format json --out PATH' instead." |
| 105 | + end |
| 106 | + if options[:emit_json_stdout] |
| 107 | + $stderr.puts "WARNING: '--emit-json-stdout' is deprecated. Use '--format json' instead." |
| 108 | + end |
97 | 109 | markup = options[:markup] |
98 | 110 | generate_options[:markup] = markup if markup |
99 | 111 | generate_options[:path] = options[:out] if options[:out] |
100 | 112 | generate_options[:stdout] = options[:stdout] |
101 | 113 | format = options[:format] || "" |
102 | | - if format.casecmp 'markdown' |
| 114 | + if format.casecmp('markdown') == 0 |
103 | 115 | generate_options[:markdown] = true |
104 | | - elsif format.casecmp 'json' |
| 116 | + elsif format.casecmp('json') == 0 || options[:emit_json] || options[:emit_json_stdout] |
105 | 117 | generate_options[:json] = true |
106 | 118 | end |
107 | 119 | end |
|
0 commit comments