Module: Aspera::Cli::OptionSource

Defined in:
lib/aspera/cli/option_types.rb

Overview

Sources of option values. A value is ignored if the option was already set from a source with higher priority.

Constant Summary collapse

PRIORITY =

Source -> priority (higher wins)

{
  default:       0,
  # Default preset for plugin (added with `override: false`)
  plugin_preset: 1,
  preset:        2,
  env:           3,
  cmdline:       4,
  # Set by code, or asked to user: same as command line
  code:          4,
  interactive:   4
}.freeze

Class Method Summary collapse

Class Method Details

.priority(source) ⇒ Integer

Returns priority of source.

Parameters:

  • source (Symbol) —

    one of PRIORITY keys

Returns:

  • (Integer) —

    priority of source



97
98
99
# File 'lib/aspera/cli/option_types.rb', line 97

def priority(source)
  PRIORITY.fetch(source) { Aspera.error_unexpected_value(source) { 'option source' } }
end