Sha256: 89f8067ab2c23a3f830c8ebf33591fcec479740a05cb86a8acbe193ecddfa4af
Contents?: true
Size: 1.36 KB
Versions: 7
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true module Milestoner module CLI module Parsers # Handles parsing of Command Line Interface (CLI) security options. class Security def self.call configuration = Configuration::Loader.call, client: CLIENT new(configuration, client: client).call end def initialize configuration = Configuration::Loader.call, client: CLIENT @configuration = configuration @client = client end def call arguments = [] client.separator "\nSECURITY OPTIONS:\n" add_sign arguments.empty? ? arguments : client.parse!(arguments) end private attr_reader :configuration, :client def add_sign client.on( "--[no-]sign", %(Sign with GPG key. Default: #{configuration.git_tag_sign}.) ) do |value| compute_git_tag_sign value end end def compute_git_tag_sign value truth_table = [true, false].repeated_permutation(2).to_a case truth_table.index [value, configuration.git_tag_sign] when 0..1 then configuration.git_tag_sign = true when 2..3 then configuration.git_tag_sign = false else fail Error, "--sign must be a boolean. Check gem configuration." end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems