Class: OptionsParser::ScriptOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/obfuskit/options_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScriptOptions

Returns a new instance of ScriptOptions.



9
10
11
12
13
14
15
16
# File 'lib/obfuskit/options_parser.rb', line 9

def initialize
  self.output_language = nil
  self.env_var_keys = []
  self.package_name = nil
  self.output_type_name = "ObfusKit"
  self.dot_env_file_path = ".env"
  self.keep_annotation = nil
end

Instance Attribute Details

#dot_env_file_pathObject

Returns the value of attribute dot_env_file_path.



7
8
9
# File 'lib/obfuskit/options_parser.rb', line 7

def dot_env_file_path
  @dot_env_file_path
end

#env_var_keysObject

Returns the value of attribute env_var_keys.



7
8
9
# File 'lib/obfuskit/options_parser.rb', line 7

def env_var_keys
  @env_var_keys
end

#keep_annotationObject

Returns the value of attribute keep_annotation.



7
8
9
# File 'lib/obfuskit/options_parser.rb', line 7

def keep_annotation
  @keep_annotation
end

#output_languageObject

Returns the value of attribute output_language.



7
8
9
# File 'lib/obfuskit/options_parser.rb', line 7

def output_language
  @output_language
end

#output_type_nameObject

Returns the value of attribute output_type_name.



7
8
9
# File 'lib/obfuskit/options_parser.rb', line 7

def output_type_name
  @output_type_name
end

#package_nameObject

Returns the value of attribute package_name.



7
8
9
# File 'lib/obfuskit/options_parser.rb', line 7

def package_name
  @package_name
end

Instance Method Details

#define_options(parser) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/obfuskit/options_parser.rb', line 18

def define_options(parser)
  parser.banner = "Usage: obfuskit [options]"
  parser.separator ""
  parser.separator "Specific options:"

  # add additional options
  output_language_option(parser)
  env_var_keys_option(parser)
  package_name_option(parser)
  output_type_name_option(parser)
  dot_env_file_path_options(parser)
  keep_annotation_options(parser)

  parser.separator ""
  parser.separator "Common options:"
  # No argument, shows at tail.  This will print an options summary.
  # Try it and see!
  parser.on_tail("-h", "--help", "Show this message") do
    puts parser
    exit
  end

  # Another typical switch to print the version.
  parser.on_tail("-v", "--version", "Show version") do
    puts Obfuskit::VERSION
    exit
  end

end