Sha256: 4c677a4130a5c99fa5082e04556b5c26818e542b14337e358171bbde9278da29

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'optparse'
require_relative '../lib/ansible_doc_generator'

options = {
  lang: 'en'
}

option_parser = OptionParser.new do |opts|
  opts.banner = 'Usage: ansible-doc-generator [options]'

  opts.on("-p playbook_path", "--playbook=playbook_path", String, "Path to the playbook") do |playbook|
    options[:playbook] = playbook
  end

  opts.on("-l es|en", "--lang=es|en", String, "Documentation language (default en)") do |lang|
    options[:lang] = lang
  end

  opts.on('-h', '--help', 'Show this message') do
    puts opts
    exit
  end
end

begin
  option_parser.parse!
rescue OptionParser::ParseError => e
  warn e.message.capitalize
  warn 'Type "ansible_doc_generator -h" for available options'
  exit
end

abort(option_parser.help) if options[:playbook].nil?

# Run generator
AnsibleDocGenerator::DocGenerator.new(options[:playbook], options[:lang]).call

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ansible_doc_generator-0.1.0 bin/ansible-doc-generator