howzit 1.2.16 → 1.2.19

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: 14bc9569ad9313ee45f42b23fb1181ad3c70c4c7d7c69d436feff9804035c3ac
4
- data.tar.gz: e40a8f4ca0e99a8e68c6df996d24bcd121a1d69dde2780f3836237303cf85e2c
3
+ metadata.gz: d8b16b06b6f594b321d2226b4985c51330b437cda97528e120b09e1bfa9d777c
4
+ data.tar.gz: fda79561390a39336c2bfe2aa94de7c6d81ce97b71e8721cf91066ec495d4080
5
5
  SHA512:
6
- metadata.gz: bfa974d861fe4d225239d8b4ed496a46feeba3048b7b1eba4ec61bc5fdc5ad33e46cd1dab97dcf4553b64b916bf59cb28a8d1f3605cff6a7d222752266e0e644
7
- data.tar.gz: 02c3c096d1841122c1e027274912b233e167a073c711945cad72186741e759f1c007d421a5accee7c86c0474742a033789e076a53d4858852c673317ccd0b56b
6
+ metadata.gz: e20d289047b1824e0f882895b580703003514c09424dbd848a461d7ed1680b2368d5ac0f11143a0fdd21eaab80a23545c0e4ceb131964003b442c8f112654a1b
7
+ data.tar.gz: 4b5af891c82a9e1dcaec9177a025336d023873114e87ce906f1a0cdaa49845e02d113e60d90395fbbde2568a99b0766af3c889d4f8786e4f24e36d52a408c2a7
data/.rubocop.yml CHANGED
@@ -4,6 +4,11 @@ AllCops:
4
4
  - Guardfile
5
5
  - Rakefile
6
6
 
7
+ Metrics/BlockLength:
8
+ Exclude:
9
+ - bin/howzit
10
+ - lib/*.rb
11
+
7
12
  Style/RegexpLiteral:
8
13
  Exclude:
9
14
  - Guardfile
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ### 1.2.19
2
+
3
+ 2022-08-03 12:18
4
+
5
+ #### FIXED
6
+
7
+ - --config-get returning non-default options
8
+
9
+ ### 1.2.18
10
+
11
+ 2022-08-03 12:13
12
+
13
+ #### FIXED
14
+
15
+ - Unwritable content property
16
+
17
+ ### 1.2.17
18
+
19
+ 2022-08-03 12:10
20
+
21
+ #### FIXED
22
+
23
+ - Variables in topics not being replaced with metadata
24
+ - Allow default response in yes/no prompt
25
+
1
26
  ### 1.2.16
2
27
 
3
28
  2022-08-03 11:41
data/bin/howzit CHANGED
@@ -95,9 +95,9 @@ OptionParser.new do |opts|
95
95
 
96
96
  opts.on('--config-get [KEY]', 'Display the configuration settings or setting for a specific key') do |k|
97
97
  if k.nil?
98
- Howzit.options.sort_by { |key, _| key }.each do |key, val|
98
+ Howzit::Config::DEFAULTS.sort_by { |key, _| key }.each do |key, val|
99
99
  print "#{key}: "
100
- p val
100
+ p Howzit.options[key]
101
101
  end
102
102
  else
103
103
  k.sub!(/^:/, '')
@@ -126,7 +126,7 @@ OptionParser.new do |opts|
126
126
  Process.exit 0
127
127
  end
128
128
 
129
- opts.on('--edit-config', "Edit configuration file using default $EDITOR") do
129
+ opts.on('--edit-config', 'Edit configuration file using default $EDITOR') do
130
130
  Howzit.config.editor
131
131
  Process.exit 0
132
132
  end
@@ -141,20 +141,20 @@ OptionParser.new do |opts|
141
141
  Dir.glob('*.md').each do |file|
142
142
  template = File.basename(file, '.md')
143
143
  puts Howzit::Color.template("{Mk}template:{Yk}#{template}{x}")
144
- puts Howzit::Color.template("{bk}[{bl}tasks{bk}]──────────────────────────────────────┐{x}")
144
+ puts Howzit::Color.template('{bk}[{bl}tasks{bk}]──────────────────────────────────────┐{x}')
145
145
  metadata = file.extract_metadata
146
146
  topics = Howzit.buildnote.read_file(file)
147
147
  topics.each do |topic|
148
148
  puts Howzit::Color.template(" {bk}│{bw}-{x} {bcK}#{template}:#{topic.title.sub(/^.*?:/, '')}{x}")
149
149
  end
150
- if metadata.size > 0
150
+ unless metadata.empty?
151
151
  meta = []
152
- meta << metadata['required'].split(/\s*,\s*/).map {|m| "*{bw}#{m}{xw}" } if metadata.key?('required')
153
- meta << metadata['optional'].split(/\s*,\s*/).map {|m| "#{m}" } if metadata.key?('optional')
154
- puts Howzit::Color.template("{bk}[{bl}meta{bk}]───────────────────────────────────────┤{x}")
155
- puts Howzit::Color.template(" {bk}│ {xw}#{meta.join(", ")}{x}")
152
+ meta << metadata['required'].split(/\s*,\s*/).map { |m| "*{bw}#{m}{xw}" } if metadata.key?('required')
153
+ meta << metadata['optional'].split(/\s*,\s*/).map(&:to_s) if metadata.key?('optional')
154
+ puts Howzit::Color.template('{bk}[{bl}meta{bk}]───────────────────────────────────────┤{x}')
155
+ puts Howzit::Color.template(" {bk}│ {xw}#{meta.join(', ')}{x}")
156
156
  end
157
- puts Howzit::Color.template(" {bk}└───────────────────────────────────────────┘{x}")
157
+ puts Howzit::Color.template(' {bk}└───────────────────────────────────────────┘{x}')
158
158
  end
159
159
  Process.exit 0
160
160
  end
@@ -9,7 +9,7 @@ module Howzit
9
9
 
10
10
  def initialize(file: nil, args: [])
11
11
  @topics = []
12
- @metadata = {}
12
+ @metadata = IO.read(note_file).split(/^#/)[0].strip.get_metadata
13
13
 
14
14
  read_help(file)
15
15
  end
@@ -274,7 +274,6 @@ module Howzit
274
274
 
275
275
  if leader.length > 0
276
276
  data = leader.get_metadata
277
- @metadata = @metadata.merge(data)
278
277
 
279
278
  if data.key?('template')
280
279
  templates = data['template'].strip.split(/\s*,\s*/)
@@ -380,6 +379,7 @@ module Howzit
380
379
  title = "#{short_path}:#{title}"
381
380
  end
382
381
  topic = Topic.new(title, prefix + lines.join("\n").strip.render_template(@metadata))
382
+
383
383
  topics.push(topic)
384
384
  end
385
385
 
data/lib/howzit/prompt.rb CHANGED
@@ -14,7 +14,7 @@ module Howzit
14
14
  res.chomp!
15
15
  puts
16
16
  system 'stty cooked'
17
- res =~ /y/i
17
+ res.empty? ? default : res =~ /y/i
18
18
  end
19
19
 
20
20
  def color_single_options(choices = %w[y n])
@@ -46,7 +46,7 @@ module Howzit
46
46
  '-0',
47
47
  '-1',
48
48
  '-m',
49
- "--height=#{matches.count + 2}",
49
+ "--height=#{matches.count + 3}",
50
50
  '--header="Use tab to mark multiple selections, enter to display/run"',
51
51
  '--prompt="Select a section > "'
52
52
  ]
data/lib/howzit/topic.rb CHANGED
@@ -5,7 +5,9 @@ module Howzit
5
5
  class Topic
6
6
  attr_writer :parent
7
7
 
8
- attr_reader :title, :content, :tasks, :prereqs, :postreqs
8
+ attr_accessor :content
9
+
10
+ attr_reader :title, :tasks, :prereqs, :postreqs
9
11
 
10
12
  def initialize(title, content)
11
13
  @title = title
@@ -2,5 +2,5 @@
2
2
  # Primary module for this gem.
3
3
  module Howzit
4
4
  # Current Howzit version.
5
- VERSION = '1.2.16'.freeze
5
+ VERSION = '1.2.19'.freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.16
4
+ version: 1.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra