Sha256: 7abbf82ca82eeb8da7ddb9b7958f56258dc3cfa49ac3468110d23c425a39d42c
Contents?: true
Size: 2 KB
Versions: 1
Compression:
Stored size: 2 KB
Contents
#!/usr/bin/env ruby require 'sord' require 'commander/import' require 'bundler' program :name, 'sord' program :version, Sord::VERSION program :description, 'Generate Sorbet RBIs from YARD documentation' default_command :gen command :gen do |c| c.syntax = 'sord gen <output-file> [options]' c.description = 'Generates an RBI file from this directory\'s YARD docs' c.option '--[no-]sord-comments', 'Controls informational/warning comments in the RBI file' c.option '--[no-]regenerate', 'Controls whether YARD is executed before Sord runs' c.option '--break-params INTEGER', Integer, 'Break params onto their own lines if there are this many' c.option '--replace-errors-with-untyped', 'Uses T.untyped rather than SORD_ERROR_ constants' c.option '--replace-unresolved-with-untyped', 'Uses T.untyped when Sord is unable to resolve a constant' c.option '--exclude-messages STRING', String, 'Blacklists a comma-separated string of log message types' c.option '--include-messages STRING', String, 'Whitelists a comma-separated string of log message types' c.option '--keep-original-comments', 'Retains original YARD comments rather than converting them to Markdown' c.action do |args, options| options.default( sord_comments: true, regenerate: true, break_params: 4, replace_errors_with_untyped: false, replace_unresolved_with_untyped: false, exclude_messages: nil, include_messages: nil, keep_original_comments: false ) if args.length != 1 Sord::Logging.error('Must specify filename') exit 1 end plugin_options = options.__hash__ plugin_options[:exclude_options] = plugin_options[:exclude_options]&.split(',') plugin_options[:include_options] = plugin_options[:include_options]&.split(',') plugin = Sord::ParlourPlugin.new(plugin_options) plugin.parlour = Parlour::RbiGenerator.new(break_params: plugin_options[:break_params]) plugin.generate(plugin.parlour.root) File.write(args.first, plugin.parlour.rbi) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sord-0.10.0 | exe/sord |