Class: Fig::Command::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/fig/command/options.rb,
lib/fig/command/options/parser.rb

Overview

Command-line processing.

Defined Under Namespace

Classes: Parser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



86
87
88
89
# File 'lib/fig/command/options.rb', line 86

def initialize()
  @home   = ENV['FIG_HOME'] || File.expand_path('~/.fighome')
  @parser = Fig::Command::Options::Parser.new()
end

Instance Attribute Details

#asset_statementsObject (readonly)

Returns the value of attribute asset_statements.



60
61
62
# File 'lib/fig/command/options.rb', line 60

def asset_statements
  @asset_statements
end

#command_extra_argvObject (readonly)

Returns the value of attribute command_extra_argv.



61
62
63
# File 'lib/fig/command/options.rb', line 61

def command_extra_argv
  @command_extra_argv
end

#configObject (readonly)

Returns the value of attribute config.



62
63
64
# File 'lib/fig/command/options.rb', line 62

def config
  @config
end

#descriptorObject (readonly)

Returns the value of attribute descriptor.



63
64
65
# File 'lib/fig/command/options.rb', line 63

def descriptor
  @descriptor
end

#environment_statementsObject (readonly)

Returns the value of attribute environment_statements.



64
65
66
# File 'lib/fig/command/options.rb', line 64

def environment_statements
  @environment_statements
end

#exit_codeObject (readonly)

Returns the value of attribute exit_code.



65
66
67
# File 'lib/fig/command/options.rb', line 65

def exit_code
  @exit_code
end

#figrcObject (readonly)

Returns the value of attribute figrc.



66
67
68
# File 'lib/fig/command/options.rb', line 66

def figrc
  @figrc
end

#file_to_find_package_forObject (readonly)

Returns the value of attribute file_to_find_package_for.



67
68
69
# File 'lib/fig/command/options.rb', line 67

def file_to_find_package_for
  @file_to_find_package_for
end

#homeObject (readonly)

Returns the value of attribute home.



68
69
70
# File 'lib/fig/command/options.rb', line 68

def home
  @home
end

#log_configObject (readonly)

Returns the value of attribute log_config.



69
70
71
# File 'lib/fig/command/options.rb', line 69

def log_config
  @log_config
end

#log_levelObject (readonly)

Returns the value of attribute log_level.



71
72
73
# File 'lib/fig/command/options.rb', line 71

def log_level
  @log_level
end

#log_to_stdoutObject (readonly)

Returns the value of attribute log_to_stdout.



70
71
72
# File 'lib/fig/command/options.rb', line 70

def log_to_stdout
  @log_to_stdout
end

#package_definition_fileObject (readonly)

Returns the value of attribute package_definition_file.



72
73
74
# File 'lib/fig/command/options.rb', line 72

def package_definition_file
  @package_definition_file
end

#parserObject (readonly)

Returns the value of attribute parser.



73
74
75
# File 'lib/fig/command/options.rb', line 73

def parser
  @parser
end

#publish_commentObject (readonly)

Returns the value of attribute publish_comment.



74
75
76
# File 'lib/fig/command/options.rb', line 74

def publish_comment
  @publish_comment
end

#publish_comment_pathObject (readonly)

Returns the value of attribute publish_comment_path.



75
76
77
# File 'lib/fig/command/options.rb', line 75

def publish_comment_path
  @publish_comment_path
end

#shell_commandObject (readonly)

Returns the value of attribute shell_command.



76
77
78
# File 'lib/fig/command/options.rb', line 76

def shell_command
  @shell_command
end

#suppress_cleanup_of_retrievesObject (readonly)

Returns the value of attribute suppress_cleanup_of_retrieves.



77
78
79
# File 'lib/fig/command/options.rb', line 77

def suppress_cleanup_of_retrieves
  @suppress_cleanup_of_retrieves
end

#suppress_includesObject (readonly)

Returns the value of attribute suppress_includes.



78
79
80
# File 'lib/fig/command/options.rb', line 78

def suppress_includes
  @suppress_includes
end

#suppress_retrievesObject (readonly)

Returns the value of attribute suppress_retrieves.



79
80
81
# File 'lib/fig/command/options.rb', line 79

def suppress_retrieves
  @suppress_retrieves
end

#update_lock_responseObject (readonly)

Returns the value of attribute update_lock_response.



80
81
82
# File 'lib/fig/command/options.rb', line 80

def update_lock_response
  @update_lock_response
end

#variable_to_getObject (readonly)

Returns the value of attribute variable_to_get.



81
82
83
# File 'lib/fig/command/options.rb', line 81

def variable_to_get
  @variable_to_get
end

#verboseObject (readonly)

Returns the value of attribute verbose.



82
83
84
# File 'lib/fig/command/options.rb', line 82

def verbose
  @verbose
end

#version_messageObject

Returns the value of attribute version_message.



83
84
85
# File 'lib/fig/command/options.rb', line 83

def version_message
  @version_message
end

#version_plainObject

Returns the value of attribute version_plain.



84
85
86
# File 'lib/fig/command/options.rb', line 84

def version_plain
  @version_plain
end

Instance Method Details

#actionsObject



122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/fig/command/options.rb', line 122

def actions()
  actions = []

  # Update has got to come first so that the Repository knows what's going
  # on.
  if @update_action
    actions << @update_action
  end
  if @base_action
    actions << @base_action
  end

  return actions
end

#force?Boolean

Returns:

  • (Boolean)


137
138
139
# File 'lib/fig/command/options.rb', line 137

def force?()
  return @force
end

#full_help_messageObject



149
150
151
# File 'lib/fig/command/options.rb', line 149

def full_help_message()
  return @parser.full_help + EXTRA_OPTIONS_DESCRIPTION
end

#login?Boolean

Returns:

  • (Boolean)


157
158
159
# File 'lib/fig/command/options.rb', line 157

def login?()
  return @login
end

#no_figrc?Boolean

Returns:

  • (Boolean)


161
162
163
# File 'lib/fig/command/options.rb', line 161

def no_figrc?()
  return @no_figrc
end

#no_remote_figrc?Boolean

Returns:

  • (Boolean)


165
166
167
# File 'lib/fig/command/options.rb', line 165

def no_remote_figrc?()
  return @no_remote_figrc
end

#options_messageObject



153
154
155
# File 'lib/fig/command/options.rb', line 153

def options_message()
  return @parser.options_message + EXTRA_OPTIONS_DESCRIPTION
end

#process_command_line(argv) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/fig/command/options.rb', line 91

def process_command_line(argv)
  argv = argv.clone
  strip_shell_command(argv)

  set_up_parser()

  @parser.parse!(argv)

  if not exit_code.nil?
    return
  end

  if argv.size > 1
    $stderr.puts %q<Extra arguments. Should only have a package/version after all other options. Had "> + argv.join(%q<", ">) + %q<" left over.>
    @exit_code = 1
    return
  end

  derive_primary_descriptor(argv.first)
  if not @base_action and @descriptor
    set_base_action(Fig::Command::Action::RunCommandStatement)
  end
  set_up_sub_actions()

  validate

  actions().each {|action| action.configure(self)}

  return
end

#short_help_messageObject



145
146
147
# File 'lib/fig/command/options.rb', line 145

def short_help_message()
  return @parser.short_help
end

#suppress_vcs_comments_in_published_packages?Boolean

Returns:

  • (Boolean)


141
142
143
# File 'lib/fig/command/options.rb', line 141

def suppress_vcs_comments_in_published_packages?()
  return @suppress_vcs_comments_in_published_packages
end

#suppress_warning_include_statement_missing_version?Boolean

Returns:

  • (Boolean)


173
174
175
# File 'lib/fig/command/options.rb', line 173

def suppress_warning_include_statement_missing_version?()
  return @suppress_warning_include_statement_missing_version
end

#suppress_warning_unused_override?Boolean

Returns:

  • (Boolean)


181
182
183
# File 'lib/fig/command/options.rb', line 181

def suppress_warning_unused_override?()
  return @suppress_warning_unused_override
end

#suppress_warning_unused_retrieve?Boolean

Returns:

  • (Boolean)


177
178
179
# File 'lib/fig/command/options.rb', line 177

def suppress_warning_unused_retrieve?()
  return @suppress_warning_unused_retrieve
end

#usec_mtime_comparisons?Boolean

Returns:

  • (Boolean)


169
170
171
# File 'lib/fig/command/options.rb', line 169

def usec_mtime_comparisons?
  return @usec_mtime_comparisons
end