Sha256: 948702f295be9642409ec39f52df3e253dee876f4e1b81bc141f515975196c28
Contents?: true
Size: 1.12 KB
Versions: 14
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require "refinements/structs" module Pragmater module CLI module Parsers # Parses common command line flags. class Flag using Refinements::Structs def self.call(...) = new(...).call def initialize configuration = Container[:configuration], client: Parser::CLIENT @configuration = configuration @client = client end def call arguments = [] client.separator "\nOPTIONS:\n" collate client.parse arguments configuration end private attr_reader :configuration, :client def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method } def add_comments client.on "--comments a,b,c", Array, "Add pragma comments. Default: []." do |comments| configuration.merge! comments: end end def add_includes client.on "--includes a,b,c", Array, "Add include patterns. Default: []." do |includes| configuration.merge! includes: end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems