Module: ActionDoc
- Defined in:
- lib/actiondoc.rb,
lib/actiondoc/version.rb,
lib/actiondoc/generator.rb
Overview
The ActionDoc CLI
Defined Under Namespace
Classes: Error, Generator, TemplateModel
Constant Summary collapse
- VERSION =
'0.4.0'
- INPUTS_SECTION_ERB =
For ERB binding
"## Inputs\n\n<% inputs_table.each do |row| -%>\n<%= \"|\" + row.join(\"|\") + \"|\" %>\n<% end -%>\n"
- NO_INPUTS =
"\n## Inputs\n\nThis action has no inputs.\n"
Class Method Summary collapse
-
.build_optparser(options) ⇒ Object
Builds and returns the OptionParser.
-
.parse_options ⇒ Object
Builds the OptionParser and parses the options.
-
.run ⇒ Object
The main CLI entrypoint.
Class Method Details
.build_optparser(options) ⇒ Object
Builds and returns the OptionParser
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/actiondoc.rb', line 36 def build_optparser() OptionParser.new do |opts| opts. = " Usage:\n\n actiondoc [options] [ACTION_YAML_FILE]\n\n Where:\n [ACTION_YAML_FILE] is the path to the action.yaml file. Defaults to \"action.yaml\"\n in the current directory.\n\n Options:\n BANNER\n\n opts.on('--template=TEMPLATE_FILENAME', '-t=TEMPLATE_FILENAME', 'The template to use') do |template_filename|\n options[:template] = template_filename\n end\n opts.on('--version', 'Show the version') do\n puts \"actiondoc v\#{ActionDoc::VERSION}\"\n exit\n end\n opts.on('--help', 'Display this help text') do\n puts opts\n exit\n end\n end\nend\n" |
.parse_options ⇒ Object
Builds the OptionParser and parses the options
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/actiondoc.rb', line 20 def = {} optparser = build_optparser() begin optparser.parse! rescue OptionParser::InvalidOption, OptionParser::MissingArgument puts $ERROR_INFO.to_s puts optparser exit end end |
.run ⇒ Object
The main CLI entrypoint
13 14 15 16 17 |
# File 'lib/actiondoc.rb', line 13 def run = ActionDoc::Generator.new(ARGV, ).run end |