howzit 1.2.12 → 1.2.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 875d039552876588bf298e4297ffec3955a6a73da6c2f89f608f7d11ed9d4e93
4
- data.tar.gz: ecd7f0dd8f67999de4e223745f79096cc06ebd84e867400bc729f2323e8f8360
3
+ metadata.gz: c2df5a80f8f5ab2a265c424015adbcda29a16050e28411a194cb7b4c7eecdf6f
4
+ data.tar.gz: fe974160b092d27f9901e91ddaf5d83b6f1b0c494108e1bd12d23a865e05e56a
5
5
  SHA512:
6
- metadata.gz: bfcad0fc1a4fbf0140dc91ae5cf03e52c3d42aed4a404c91fab642db05d9849b92c0c73d4f87d79ca0b58d1583a6a0ab5ef0ef9936812913567aeb3f24508a93
7
- data.tar.gz: db44b03b2f2c25c84187692a9d46a328a22d4a7dce0adc20304ab31fe58e91b6ca4bef6848ab69efcce5e0c60e9c8955501f4232d5643f664d35cb81da9bcbdf
6
+ metadata.gz: d71faacd4a0d7ae0ce10e089302c2ef8d32ece37479c718690b48b3d969d6725018665299a63d787b36419131ccc8642e94a638580aa38030ec51191a1e29d45
7
+ data.tar.gz: 997f94412dd2f580ca712aead5d8609fa71044744c5ed0d4437d161331ae9ff58ad5f28f61ed8b969eca158551e131b730285b7e920c5f6347e4641db816385e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ### 1.2.15
2
+
3
+ 2022-08-02 11:59
4
+
5
+ #### NEW
6
+
7
+ - Option to set :header_format: to block for alternate topic title appearance
8
+
9
+ #### FIXED
10
+
11
+ - Missing spacing around topic titles when displaying multiple topics
12
+
13
+ ### 1.2.14
14
+
15
+ 2022-08-02 11:01
16
+
17
+ #### NEW
18
+
19
+ - Config option and flag to determine how to handle multiple results (first, best, all, choose)
20
+ - --config-get and --config-set flags for working with config options
21
+
22
+ #### IMPROVED
23
+
24
+ - Allow multiple selections when using fzf
25
+ - Clean up newlines in output
26
+
27
+ ### 1.2.13
28
+
29
+ 2022-08-01 20:50
30
+
1
31
  ### 1.2.12
2
32
 
3
33
  2022-08-01 16:23
data/README.md CHANGED
@@ -24,11 +24,10 @@ Howzit is a tool that allows you to keep Markdown-formatted notes about a projec
24
24
 
25
25
  ## Getting Started
26
26
 
27
- Howzit is a simple, self-contained script (at least until I get stupid and make a gem out of it).
28
-
29
27
  ### Prerequisites
30
28
 
31
29
  - Ruby 2.4+ (It probably works on older Rubys, but is untested prior to 2.4.1.)
30
+ - Optional: if [`fzf`](https://github.com/junegunn/fzf) is available, it will be used for handling multiple choice selections
32
31
  - Optional: if [`bat`](https://github.com/sharkdp/bat) is available it will page with that
33
32
  - Optional: [`mdless`](https://github.com/ttscoff/mdless) or [`mdcat`](https://github.com/lunaryorn/mdcat) for formatting output
34
33
 
@@ -200,6 +199,10 @@ Include a topic name to see just that topic, or no argument to display all.
200
199
 
201
200
  howzit build
202
201
 
202
+ You can combine multiple topic searches by separating with a comma. When multiple results are returned, the `:multiple_results:` configuration determines how they're handled.
203
+
204
+ howzit build,deploy
205
+
203
206
  Use `-l` to list all topics.
204
207
 
205
208
  howzit -l
@@ -216,12 +219,15 @@ Other options:
216
219
 
217
220
  Options:
218
221
  -c, --create Create a skeleton build note in the current working directory
219
- -e, --edit Edit buildnotes file in current working directory using editor.sh
222
+ -e, --edit Edit buildnotes file in current working directory
223
+ using $EDITOR
220
224
  --grep PATTERN Display sections matching a search pattern
221
225
  -L, --list-completions List topics for completion
222
226
  -l, --list List available topics
223
227
  -m, --matching TYPE Topics matching type
224
228
  (partial, exact, fuzzy, beginswith)
229
+ --multiple TYPE Multiple result handling
230
+ (first, all, choose)
225
231
  -R, --list-runnable List topics containing @ directives (verbose)
226
232
  -r, --run Execute @run, @open, and/or @copy commands for given topic
227
233
  -s, --select Select topic from menu
@@ -229,10 +235,10 @@ Other options:
229
235
  -t, --title Output title with build notes
230
236
  -q, --quiet Silence info message
231
237
  --verbose Show all messages
232
- -u, --upstream Traverse up parent directories for additional build notes
238
+ -u, --[no-]upstream Traverse up parent directories for additional build notes
233
239
  --show-code Display the content of fenced run blocks
234
240
  -w, --wrap COLUMNS Wrap to specified width (default 80, 0 to disable)
235
- --edit-config Edit configuration file using editor.sh
241
+ --edit-config Edit configuration file using default $EDITOR
236
242
  --title-only Output title only
237
243
  --templates List available templates
238
244
  --[no-]color Colorize output (default on)
@@ -240,6 +246,7 @@ Other options:
240
246
  --[no-]pager Paginate output (default on)
241
247
  -h, --help Display this screen
242
248
  -v, --version Display version number
249
+ --default Answer all prompts with default response
243
250
 
244
251
 
245
252
  ## Configuration
@@ -257,6 +264,8 @@ Some of the command line options can be set as defaults. The first time you run
257
264
  :matching: partial
258
265
  :include_upstream: false
259
266
  :log_level: 1
267
+ :multiple_matches: choose
268
+ :header_format: border
260
269
 
261
270
  If `:color:` is false, output will not be colored, and markdown highlighting will be bypassed.
262
271
 
@@ -272,6 +281,10 @@ If `:include_upstream:` is true, build note files in parent directories will be
272
281
 
273
282
  Set `:log_level:` to 0 for debug messages, or 3 to suppress superfluous info messages.
274
283
 
284
+ `:multiple_matches:` determines how howzit will handle cases where a search results in multiple matches. It can be set to "first" (first match in notes), "best" (shortest topic match), "all" (display all results), or "choose" (displays a menu of results). Default is "choose." When grepping for results, only "all" or "choose" are valid, if the default is something else, "choose" will be used. Can be overridden with the `--multiple TYPE` flag.
285
+
286
+ `:header_format:` changes the way topic titles are displayed. Setting it to "border" will add a horizontal rule and brackets around the title. Setting it to "block" will mark topic titles with a unicode block instead.
287
+
275
288
  ### Matching
276
289
 
277
290
  All matching is case insensitive. This setting can be overridden by the `--matching TYPE` flag on the command line.
data/Rakefile CHANGED
@@ -29,3 +29,8 @@ task :ver do
29
29
  puts "version.rb: #{version}"
30
30
  puts "changelog: #{cver}"
31
31
  end
32
+
33
+ desc 'Changelog version check'
34
+ task :cver do
35
+ puts IO.read(File.join(File.dirname(__FILE__), 'CHANGELOG.md')).match(/^#+ (\d+\.\d+\.\d+(\w+)?)/)[1]
36
+ end
@@ -124,7 +124,7 @@ module Howzit
124
124
  pipes = "|#{hl}" if hl
125
125
  end
126
126
 
127
- output = `echo #{Shellwords.escape(string.strip)}#{pipes}`
127
+ output = `echo #{Shellwords.escape(string.strip)}#{pipes}`.strip
128
128
 
129
129
  if @options[:paginate]
130
130
  page(output)
@@ -160,30 +160,40 @@ module Howzit
160
160
  warn "\nCanceled"
161
161
  exit!
162
162
  end
163
+ default = !$stdout.isatty || @options[:default]
163
164
  # First make sure there isn't already a buildnotes file
164
165
  if note_file
165
166
  fname = Color.template("{by}#{note_file}{bw}")
166
- res = yn("#{fname} exists and appears to be a build note, continue anyway?", false)
167
- unless res
168
- puts 'Canceled'
169
- Process.exit 0
167
+ unless default
168
+ res = yn("#{fname} exists and appears to be a build note, continue anyway?", false)
169
+ unless res
170
+ puts 'Canceled'
171
+ Process.exit 0
172
+ end
170
173
  end
171
174
  end
172
175
 
173
176
  title = File.basename(Dir.pwd)
174
- printf Color.template("{bw}Project name {xg}[#{title}]{bw}: {x}")
175
- input = $stdin.gets.chomp
176
- title = input unless input.empty?
177
-
177
+ if default
178
+ input = title
179
+ else
180
+ printf Color.template("{bw}Project name {xg}[#{title}]{bw}: {x}")
181
+ input = $stdin.gets.chomp
182
+ title = input unless input.empty?
183
+ end
178
184
  summary = ''
179
- printf Color.template('{bw}Project summary: {x}')
180
- input = $stdin.gets.chomp
181
- summary = input unless input.empty?
185
+ unless default
186
+ printf Color.template('{bw}Project summary: {x}')
187
+ input = $stdin.gets.chomp
188
+ summary = input unless input.empty?
189
+ end
182
190
 
183
191
  fname = 'buildnotes.md'
184
- printf Color.template("{bw}Build notes filename (must begin with 'howzit' or 'build')\n{xg}[#{fname}]{bw}: {x}")
185
- input = $stdin.gets.chomp
186
- fname = input unless input.empty?
192
+ unless default
193
+ printf Color.template("{bw}Build notes filename (must begin with 'howzit' or 'build')\n{xg}[#{fname}]{bw}: {x}")
194
+ input = $stdin.gets.chomp
195
+ fname = input unless input.empty?
196
+ end
187
197
 
188
198
  note = <<~EOBUILDNOTES
189
199
  # #{title}
@@ -210,7 +220,7 @@ module Howzit
210
220
 
211
221
  EOBUILDNOTES
212
222
 
213
- if File.exist?(fname)
223
+ if File.exist?(fname) && !default
214
224
  file = Color.template("{by}#{fname}")
215
225
  res = yn("Are you absolutely sure you want to overwrite #{file}", false)
216
226
 
@@ -237,17 +247,22 @@ module Howzit
237
247
 
238
248
  options.merge!(opts)
239
249
 
240
- cols = TTY::Screen.columns
250
+ case @options[:header_format]
251
+ when :block
252
+ Color.template("#{options[:color]}\u{258C}#{title}#{should_mark_iterm? && options[:mark] ? iterm_marker : ''}{x}")
253
+ else
254
+ cols = TTY::Screen.columns
241
255
 
242
- cols = @options[:wrap] if (@options[:wrap]).positive? && cols > @options[:wrap]
243
- title = Color.template("#{options[:border]}#{options[:hr] * 2}( #{options[:color]}#{title}#{options[:border]} )")
256
+ cols = @options[:wrap] if (@options[:wrap]).positive? && cols > @options[:wrap]
257
+ title = Color.template("#{options[:border]}#{options[:hr] * 2}( #{options[:color]}#{title}#{options[:border]} )")
244
258
 
245
- tail = if should_mark_iterm?
246
- "#{options[:hr] * (cols - title.uncolor.length - 15)}#{options[:mark] ? iterm_marker : ''}"
247
- else
248
- options[:hr] * (cols - title.uncolor.length)
249
- end
250
- Color.template("#{title}#{tail}{x}")
259
+ tail = if should_mark_iterm?
260
+ "#{options[:hr] * (cols - title.uncolor.length - 15)}#{options[:mark] ? iterm_marker : ''}"
261
+ else
262
+ options[:hr] * (cols - title.uncolor.length)
263
+ end
264
+ Color.template("#{title}#{tail}{x}")
265
+ end
251
266
  end
252
267
 
253
268
  def os_open(command)
@@ -346,7 +361,9 @@ module Howzit
346
361
  end
347
362
  output.push("Ran #{tasks} #{tasks == 1 ? 'task' : 'tasks'}") if @options[:log_level] < 2
348
363
 
349
- puts postreqs.join("\n\n")
364
+ puts postreqs.join("\n\n") unless postreqs.empty?
365
+
366
+ output
350
367
  end
351
368
 
352
369
  # Output a topic with fancy title and bright white text.
@@ -372,12 +389,12 @@ module Howzit
372
389
  unless matches.empty?
373
390
  if opt[:single]
374
391
  title = "From #{matches[0]}:"
375
- color = '{yK}'
376
- rule = '{kK}'
392
+ color = '{Kyd}'
393
+ rule = '{kKd}'
377
394
  else
378
395
  title = "Include #{matches[0]}"
379
- color = '{yK}'
380
- rule = '{x}'
396
+ color = '{Kyd}'
397
+ rule = '{kKd}'
381
398
  end
382
399
  output.push(format_header("#{'> ' * @nest_level}#{title}", { color: color, hr: '.', border: rule })) unless @included.include?(matches[0])
383
400
 
@@ -689,7 +706,9 @@ module Howzit
689
706
  title_only: false,
690
707
  choose: false,
691
708
  quiet: false,
692
- verbose: false
709
+ verbose: false,
710
+ default: false,
711
+ grep: nil
693
712
  }
694
713
 
695
714
  defaults = {
@@ -704,7 +723,8 @@ module Howzit
704
723
  show_all_on_error: false,
705
724
  include_upstream: false,
706
725
  show_all_code: false,
707
- grep: nil,
726
+ multiple_matches: 'choose',
727
+ header_format: 'border',
708
728
  log_level: 1 # 0: debug, 1: info, 2: warn, 3: error
709
729
  }
710
730
 
@@ -733,7 +753,7 @@ module Howzit
733
753
  end
734
754
 
735
755
  opts.on('-e', '--edit', "Edit buildnotes file in current working directory
736
- using #{File.basename(ENV['EDITOR'])}") do
756
+ using $EDITOR") do
737
757
  edit_note
738
758
  Process.exit 0
739
759
  end
@@ -756,6 +776,11 @@ module Howzit
756
776
  @options[:matching] = c
757
777
  end
758
778
 
779
+ opts.on('--multiple TYPE', MULTIPLE_OPTIONS,
780
+ 'Multiple result handling', "(#{MULTIPLE_OPTIONS.join(', ')}, default choose)") do |c|
781
+ @options[:multiple_matches] = c.to_sym
782
+ end
783
+
759
784
  opts.on('-R', '--list-runnable', 'List topics containing @ directives (verbose)') do
760
785
  @options[:list_runnable] = true
761
786
  end
@@ -797,7 +822,40 @@ module Howzit
797
822
  @options[:wrap] = w.to_i
798
823
  end
799
824
 
800
- opts.on('--edit-config', "Edit configuration file using #{File.basename(ENV['EDITOR'])}") do
825
+ opts.on('--config-get [KEY]', 'Display the configuration settings or setting for a specific key') do |k|
826
+
827
+ if k.nil?
828
+ config.sort_by { |key, _| key }.each do |key, val|
829
+ print "#{key}: "
830
+ p val
831
+ end
832
+ else
833
+ k.sub!(/^:/, '')
834
+ if config.key?(k.to_sym)
835
+ puts config[k.to_sym]
836
+ else
837
+ puts "Key #{k} not found"
838
+ end
839
+ end
840
+ Process.exit 0
841
+ end
842
+
843
+ opts.on('--config-set KEY=VALUE', 'Set a config value (must be a valid key)') do |key|
844
+ raise 'Argument must be KEY=VALUE' unless key =~ /\S=\S/
845
+
846
+ k, v = key.split(/=/)
847
+ k.sub!(/^:/, '')
848
+
849
+ if config.key?(k.to_sym)
850
+ config[k.to_sym] = v.to_config_value(config[k.to_sym])
851
+ else
852
+ puts "Key #{k} not found"
853
+ end
854
+ write_config(config)
855
+ Process.exit 0
856
+ end
857
+
858
+ opts.on('--edit-config', "Edit configuration file using default $EDITOR") do
801
859
  edit_config(defaults)
802
860
  Process.exit 0
803
861
  end
@@ -830,6 +888,11 @@ module Howzit
830
888
  Process.exit 0
831
889
  end
832
890
 
891
+ opts.on('--header-format TYPE', HEADER_FORMAT_OPTIONS,
892
+ "Formatting style for topic titles (#{HEADER_FORMAT_OPTIONS.join(', ')})") do |t|
893
+ @options[:header_format] = t
894
+ end
895
+
833
896
  opts.on('--[no-]color', 'Colorize output (default on)') do |c|
834
897
  @options[:color] = c
835
898
  @options[:highlight] = false unless c
@@ -852,8 +915,15 @@ module Howzit
852
915
  puts "Howzit v#{VERSION}"
853
916
  Process.exit 0
854
917
  end
918
+
919
+ opts.on('--default', 'Answer all prompts with default response') do
920
+ @options[:default] = true
921
+ end
855
922
  end.parse!(args)
856
923
 
924
+ @options[:multiple_matches] = @options[:multiple_matches].to_sym
925
+ @options[:header_format] = @options[:header_format].to_sym
926
+
857
927
  @cli_args = args
858
928
  end
859
929
 
@@ -986,12 +1056,20 @@ module Howzit
986
1056
 
987
1057
  def choose(matches)
988
1058
  if command_exist?('fzf')
989
- res = `echo #{Shellwords.escape(matches.join("\n"))} | fzf -0 -1 --height #{matches.count + 2} --prompt 'Select a section > '`.strip
1059
+ settings = [
1060
+ '-0',
1061
+ '-1',
1062
+ '-m',
1063
+ "--height=#{matches.count + 2}",
1064
+ '--header="Use tab to mark multiple selections, enter to display/run"',
1065
+ '--prompt="Select a section > "'
1066
+ ]
1067
+ res = `echo #{Shellwords.escape(matches.join("\n"))} | fzf #{settings.join(' ')}`.strip
990
1068
  if res.nil? || res.empty?
991
1069
  warn 'Cancelled'
992
1070
  Process.exit 0
993
1071
  end
994
- return res
1072
+ return res.split(/\n/)
995
1073
  end
996
1074
 
997
1075
  res = matches[0..9]
@@ -1040,7 +1118,7 @@ module Howzit
1040
1118
  File.join(config_dir, 'templates')
1041
1119
  end
1042
1120
 
1043
- def create_config
1121
+ def create_config(defaults)
1044
1122
  dir, file = [config_dir, config_file]
1045
1123
  unless File.directory?(dir)
1046
1124
  warn "Creating config directory at #{dir}"
@@ -1055,7 +1133,7 @@ module Howzit
1055
1133
  end
1056
1134
 
1057
1135
  def load_config(defaults)
1058
- file = create_config
1136
+ file = create_config(defaults)
1059
1137
  config = YAML.load(IO.read(file))
1060
1138
  newconfig = config ? defaults.merge(config) : defaults
1061
1139
  write_config(newconfig)
@@ -1092,7 +1170,7 @@ module Howzit
1092
1170
  out = get_note_title(20)
1093
1171
  $stdout.print(out.strip)
1094
1172
  Process.exit(0)
1095
- elsif @options[:output_title]
1173
+ elsif @options[:output_title] && !@options[:run]
1096
1174
  title = get_note_title
1097
1175
  if title && !title.empty?
1098
1176
  header = format_header(title, { hr: "\u{2550}", color: '{bwK}' })
@@ -1121,33 +1199,49 @@ module Howzit
1121
1199
  Process.exit(0)
1122
1200
  end
1123
1201
 
1124
- topic_match = nil
1202
+ topic_matches = []
1125
1203
  if @options[:grep]
1126
- topic_match = choose(grep_topics(@options[:grep]))
1204
+ matches = grep_topics(@options[:grep])
1205
+ case @options[:multiple_matches]
1206
+ when :all
1207
+ topic_matches.concat(matches.sort)
1208
+ else
1209
+ topic_matches.concat(choose(matches))
1210
+ end
1127
1211
  elsif @options[:choose]
1128
- topic_match = choose(topics.keys)
1212
+ topic_matches.concat(choose(topics.keys))
1129
1213
  # If there are arguments use those to search for a matching topic
1130
1214
  elsif !@cli_args.empty?
1215
+ search = @cli_args.join(' ').strip.downcase.split(/ *, */).map(&:strip)
1131
1216
 
1132
- search = @cli_args.join(' ').strip.downcase
1133
- matches = match_topic(search)
1217
+ search.each do |s|
1218
+ matches = match_topic(s)
1134
1219
 
1135
- if matches.empty?
1136
- output.push(Color.template(%({bR}ERROR:{xr} No topic match found for {bw}#{search}{x}\n)))
1137
- unless @options[:show_all_on_error]
1138
- show(output.join("\n"), { color: true, highlight: false, paginate: false, wrap: 0 })
1139
- Process.exit 1
1220
+ if matches.empty?
1221
+ output.push(Color.template(%({bR}ERROR:{xr} No topic match found for {bw}#{s}{x}\n)))
1222
+ else
1223
+ case @options[:multiple_matches]
1224
+ when :first
1225
+ topic_matches.push(matches[0])
1226
+ when :best
1227
+ topic_matches.push(matches.sort.min_by(&:length))
1228
+ when :all
1229
+ topic_matches.concat(matches)
1230
+ else
1231
+ topic_matches.concat(choose(matches))
1232
+ end
1140
1233
  end
1141
- elsif matches.length == 1
1142
- topic_match = matches[0]
1143
- else
1144
- topic_match = choose(matches)
1234
+ end
1235
+
1236
+ if topic_matches.empty? && !@options[:show_all_on_error]
1237
+ show(output.join("\n"), { color: true, highlight: false, paginate: false, wrap: 0 })
1238
+ Process.exit 1
1145
1239
  end
1146
1240
  end
1147
1241
 
1148
- if topic_match
1242
+ if !topic_matches.empty?
1149
1243
  # If we found a match
1150
- output.push(process_topic(topic_match, @options[:run], true))
1244
+ topic_matches.each { |topic_match| output.push(process_topic(topic_match, @options[:run], true)) }
1151
1245
  else
1152
1246
  # If there's no argument or no match found, output all
1153
1247
  topics.each_key { |k| output.push(process_topic(k, false, false)) }
data/lib/howzit/colors.rb CHANGED
@@ -232,7 +232,7 @@ module Howzit
232
232
  y: yellow, c: cyan, m: magenta, r: red,
233
233
  W: bgwhite, K: bgblack, G: bggreen, L: bgblue,
234
234
  Y: bgyellow, C: bgcyan, M: bgmagenta, R: bgred,
235
- b: bold, u: underline, i: italic, x: reset }
235
+ d: dark, b: bold, u: underline, i: italic, x: reset }
236
236
 
237
237
  format(fmt, colors)
238
238
  end
data/lib/howzit/prompt.rb CHANGED
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Howzit
4
+ # Command line prompt utils
4
5
  module Prompt
5
6
  def yn(prompt, default = true)
7
+ return default if !$stdout.isatty
8
+
6
9
  system 'stty cbreak'
7
10
  yn = color_single_options(default ? %w[Y n] : %w[y N])
8
11
  $stdout.syswrite "\e[1;37m#{prompt} #{yn}\e[1;37m? \e[0m"
@@ -3,6 +3,31 @@
3
3
  module Howzit
4
4
  # String Extensions
5
5
  module StringUtils
6
+ # Convert a string to a valid YAML value
7
+ def to_config_value(orig_value = nil)
8
+ if orig_value
9
+ case orig_value.class.to_s
10
+ when /Integer/
11
+ to_i
12
+ when /(True|False)Class/
13
+ self =~ /^(t(rue)?|y(es)?|1)$/i ? true : false
14
+ else
15
+ self
16
+ end
17
+ else
18
+ case self
19
+ when /^[0-9]+$/
20
+ to_i
21
+ when /^(t(rue)?|y(es)?)$/i
22
+ true
23
+ when /^(f(alse)?|n(o)?)$/i
24
+ false
25
+ else
26
+ self
27
+ end
28
+ end
29
+ end
30
+
6
31
  # Just strip out color codes when requested
7
32
  def uncolor
8
33
  gsub(/\e\[[\d;]+m/, '').gsub(/\e\]1337;SetMark/,'')
@@ -2,5 +2,5 @@
2
2
  # Primary module for this gem.
3
3
  module Howzit
4
4
  # Current Howzit version.
5
- VERSION = '1.2.12'.freeze
5
+ VERSION = '1.2.15'.freeze
6
6
  end
data/lib/howzit.rb CHANGED
@@ -16,3 +16,5 @@ CONFIG_DIR = '~/.config/howzit'
16
16
  CONFIG_FILE = 'howzit.yaml'
17
17
  IGNORE_FILE = 'ignore.yaml'
18
18
  MATCHING_OPTIONS = %w[partial exact fuzzy beginswith].freeze
19
+ MULTIPLE_OPTIONS = %w[first best all choose].freeze
20
+ HEADER_FORMAT_OPTIONS = %w[border block].freeze
@@ -12,7 +12,9 @@ end
12
12
 
13
13
  describe Howzit::BuildNotes do
14
14
  Dir.chdir('spec')
15
- subject { Howzit::BuildNotes.new(['--no-upstream']) }
15
+ how = Howzit::BuildNotes.new(['--no-upstream', '--default'])
16
+ how.create_note
17
+ subject { how }
16
18
 
17
19
  describe ".note_file" do
18
20
  it "locates a build note file" do
@@ -20,21 +22,15 @@ describe Howzit::BuildNotes do
20
22
  end
21
23
  end
22
24
 
23
- describe ".get_note_title" do
24
- it "is named howzit test" do
25
- expect(subject.get_note_title).to match(/howzit test/)
26
- end
27
- end
28
-
29
25
  describe ".grep_topics" do
30
- it "found editable" do
26
+ it "finds editable" do
31
27
  expect(subject.grep_topics('editable')).to include('File Structure')
32
28
  expect(subject.grep_topics('editable')).not_to include('Build')
33
29
  end
34
30
  end
35
31
 
36
32
  describe ".list_topic_titles" do
37
- it "found 4 topics" do
33
+ it "finds 4 topics" do
38
34
  expect(subject.topics.keys.count).to eq 4
39
35
  end
40
36
  it "outputs a newline-separated string" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.12
4
+ version: 1.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-01 00:00:00.000000000 Z
11
+ date: 2022-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler