module Bashly::Script::Introspection::Flags
Public Instance Methods
Source
# File lib/bashly/script/introspection/flags.rb, line 6 def default_flags flags.select(&:default) end
Returns an array of all the default Flags
Source
# File lib/bashly/script/introspection/flags.rb, line 22 def fixed_flags? root_command? || !catch_all.catch_help? end
Returns true if there is at least one fixed flag (–version / –help) Root command always has –version and subcommands always have –help except when it is consumed by catch_all
Source
# File lib/bashly/script/introspection/flags.rb, line 11 def flags return [] unless options['flags'] options['flags'].map do |options| Flag.new options end end
Returns an array of Flags
Source
# File lib/bashly/script/introspection/flags.rb, line 28 def global_flags? flags.any? and commands.any? end
Returns true if this command’s flags should be considered as gloal flags, and cascade to subcommands
Source
# File lib/bashly/script/introspection/flags.rb, line 33 def needy_flags flags.select(&:needs) end
Returns an array of all fpags that need other flags
Source
# File lib/bashly/script/introspection/flags.rb, line 38 def public_flags flags.reject(&:private) end
Returns only flags that are not private
Source
# File lib/bashly/script/introspection/flags.rb, line 43 def required_flags flags.select(&:required) end
Returns an array of all the required Flags
Source
# File lib/bashly/script/introspection/flags.rb, line 48 def short_flag_exist?(flag) flags.any? { |f| f.short == flag } end
Returns true if one of the flags matches the provided short code
Source
# File lib/bashly/script/introspection/flags.rb, line 54 def visible_flags Settings.private_reveal_key ? flags : public_flags end
Returns only public flags, or both public and private flags if Settings.private_reveal_key is set
Source
# File lib/bashly/script/introspection/flags.rb, line 59 def whitelisted_flags flags.select(&:allowed) end
Returns an array of all the flags with a whitelist arg