markdown_exec 1.3.2 → 1.3.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,18 +31,9 @@ class EnvironmentOptParse
31
31
  def menu_all(menu_data, lambdas, config)
32
32
  config.tap_yaml 'config'
33
33
  input_option_values, remainder, = menu_parse(add_proc(menu_data, lambdas))
34
- # options = menu_default_option_values(menu_data).merge input_option_values
35
- # options = (menu_default_option_values(menu_data)).merge(input_option_values).tap_yaml 'options1'
36
- options = menu_default_option_values(menu_data).merge(config).merge(input_option_values) #.tap_yaml 'options2'
37
- # options = menu_data.map do |menu_item|
38
- # menu_item.tap_inspect 'menu_item'
39
- # mion = menu_item[:opt_name]&.to_sym.tap_inspect 'mion'
40
- # omion = config[mion].tap_inspect 'omion'
41
- # unless omion.nil?
42
- # menu_item[:default] = omion
43
- # end
44
- # menu_item
45
- # end,
34
+ options = menu_default_option_values(menu_data)
35
+ .merge(config)
36
+ .merge(input_option_values)
46
37
 
47
38
  [options, remainder]
48
39
  end
@@ -53,7 +44,8 @@ class EnvironmentOptParse
53
44
  procname = menu_item[:procname]
54
45
  next if procname.nil?
55
46
 
56
- menu_item[:proccode] = lambdas.fetch(procname.to_sym, menu_item[:procname])
47
+ menu_item[:proccode] =
48
+ lambdas.fetch(procname.to_sym, menu_item[:procname])
57
49
  end.tap_yaml
58
50
  end
59
51
 
@@ -89,15 +81,21 @@ class EnvironmentOptParse
89
81
  mmoo = [
90
82
  # long name
91
83
  if item[:long_name].present?
92
- "--#{item[:long_name]}#{item[:arg_name].present? ? " #{item[:arg_name]}" : ''}"
84
+ # if "--#{item[:long_name]}#{item[:arg_name]".present?
85
+ # " #{item[:arg_name]}"
86
+ # else
87
+ # "''}"
88
+ # end
93
89
  end,
94
90
 
95
91
  # short name
96
92
  item[:short_name].present? ? "-#{item[:short_name]}" : nil,
97
93
 
98
94
  # description and default
99
- [item[:description],
100
- item[:default].present? ? "[#{value_for_menu item[:default]}]" : nil].compact.join(' '),
95
+ [
96
+ item[:description],
97
+ item[:default].present? ? "[#{value_for_menu item[:default]}]" : nil
98
+ ].compact.join(' '),
101
99
 
102
100
  # apply proccode, if present, to value
103
101
  # save value to options hash if option is named
@@ -122,7 +120,10 @@ class EnvironmentOptParse
122
120
  menu_option_append opts, options, item
123
121
  end
124
122
  end
125
- option_parser.load # filename defaults to basename of the program without suffix in a directory ~/.options
123
+
124
+ # filename defaults to basename of the program
125
+ # without suffix in a directory ~/.options
126
+ option_parser.load
126
127
  option_parser.environment # env defaults to the basename of the program.
127
128
  remainder = option_parser.parse!
128
129
 
@@ -184,12 +185,16 @@ class EnvironmentOptParse
184
185
  # lambda { |v| options.tap_puts 'eop_l' }
185
186
  # }).call(@options),
186
187
 
187
- stdout_defaults: ->(_) { menu_default_option_values(@menu).to_yaml.tap_puts },
188
+ stdout_defaults: lambda { |_|
189
+ menu_default_option_values(@menu).to_yaml.tap_puts
190
+ },
188
191
  stdout_help: lambda { |_|
189
192
  menu_help(@menu).tap_puts
190
193
  exit
191
194
  },
192
- val_as_bool: ->(value) { value.class.to_s == 'String' ? (value.chomp != '0') : value },
195
+ val_as_bool: lambda { |value|
196
+ value.class.to_s == 'String' ? (value.chomp != '0') : value
197
+ },
193
198
  val_as_int: ->(value) { value.to_i },
194
199
  val_as_str: ->(value) { value.to_s },
195
200
  version: lambda { |_|
@@ -7,5 +7,5 @@ module MarkdownExec
7
7
  BIN_NAME = 'mde'
8
8
  GEM_NAME = 'markdown_exec'
9
9
  TAP_DEBUG = 'MDE_DEBUG'
10
- VERSION = '1.3.2'
10
+ VERSION = '1.3.3.1'
11
11
  end