module Bashly::Script::Introspection::Flags

Public Instance Methods

default_flags() click to toggle source

Returns an array of all the default Flags

# File lib/bashly/script/introspection/flags.rb, line 6
def default_flags
  flags.select(&:default)
end
flags() click to toggle source

Returns an array of Flags

# 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
global_flags?() click to toggle source

Returns true if this command’s flags should be considered as gloal flags, and cascade to subcommands

# File lib/bashly/script/introspection/flags.rb, line 21
def global_flags?
  flags.any? and commands.any?
end
needy_flags() click to toggle source

Returns an array of all fpags that need other flags

# File lib/bashly/script/introspection/flags.rb, line 26
def needy_flags
  flags.select(&:needs)
end
public_flags() click to toggle source

Returns only flags that are not private

# File lib/bashly/script/introspection/flags.rb, line 31
def public_flags
  flags.reject(&:private)
end
required_flags() click to toggle source

Returns an array of all the required Flags

# File lib/bashly/script/introspection/flags.rb, line 36
def required_flags
  flags.select(&:required)
end
short_flag_exist?(flag) click to toggle source

Returns true if one of the flags matches the provided short code

# File lib/bashly/script/introspection/flags.rb, line 41
def short_flag_exist?(flag)
  flags.any? { |f| f.short == flag }
end
visible_flags() click to toggle source

Returns only public flags, or both public and private flags if Settings.private_reveal_key is set

# File lib/bashly/script/introspection/flags.rb, line 47
def visible_flags
  Settings.private_reveal_key ? flags : public_flags
end
whitelisted_flags() click to toggle source

Returns an array of all the flags with a whitelist arg

# File lib/bashly/script/introspection/flags.rb, line 52
def whitelisted_flags
  flags.select(&:allowed)
end