howzit 2.0.21 → 2.0.22

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: d7fce97cf829010799ce06890d925d1f7eaff647299398650baf9eb898eb56eb
4
- data.tar.gz: 2fb9d03d33bd616c005b164fd4420d837fcb688882f7fe98d9779bfdf3abcb4c
3
+ metadata.gz: 7e00517a83b13075c8af7884b3a5afd683f62008f6ccc8b50015044e7625a6b7
4
+ data.tar.gz: 1918ceb4965f7a5fe127581c1dd602dfa387d8e310654f5ac7ca643ab5dd4c8d
5
5
  SHA512:
6
- metadata.gz: 3af874f2a2d88af1235d803cdf547e5820f32c817f8dbdc566db7a372ae732593cfeab069ccc759a071e5216e3e62a0a9c63a3c4097255f598efeafcecb70123
7
- data.tar.gz: 60a1fdf546e005d8b274269c3a7946017fecdc7adea5d028581bac6e044a03b0e0e8df313e82252c1c56b016984c803320e59bf873602aa1a4e3eabf278976f1
6
+ metadata.gz: 549952e3e175d9fcd5df9d85400a8abc3279ff76862e172029e974920ba85aa8ef1dfb84fcdbaff94a260a5630f49c462cd58d5a97f359735978c074b9742c2d
7
+ data.tar.gz: acb315d65c7cb1f9cf3e1ee6ef9044a1f7584b23f4bc1a7d58b39acda4851a62e58d55fe53fa227807c84f01093f3f07c6ad18070ceffda92ba05fe72f137573
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### 2.0.22
2
+
3
+ 2022-08-08 13:49
4
+
5
+ #### IMPROVED
6
+
7
+ - Paginate output of --templates
8
+
9
+ #### FIXED
10
+
11
+ - --templates attempting to create new build note
12
+ - Fix handling of paths when the same as note_file
13
+
1
14
  ### 2.0.21
2
15
 
3
16
  2022-08-08 13:16
data/bin/howzit CHANGED
@@ -64,25 +64,27 @@ OptionParser.new do |opts|
64
64
  end
65
65
 
66
66
  opts.on('--templates', 'List available templates') do
67
+ out = []
67
68
  Dir.chdir(Howzit.config.template_folder)
68
69
  Dir.glob('*.md').each do |file|
69
70
  template = File.basename(file, '.md')
70
- puts Howzit::Color.template("{Mk}template:{Yk}#{template}{x}")
71
- puts Howzit::Color.template('{bk}[{bl}tasks{bk}]──────────────────────────────────────┐{x}')
71
+ out.push(Howzit::Color.template("{Mk}template:{Yk}#{template}{x}"))
72
+ out.push(Howzit::Color.template('{bk}[{bl}tasks{bk}]──────────────────────────────────────┐{x}'))
72
73
  metadata = file.extract_metadata
73
- topics = Howzit.buildnote.read_file(file)
74
+ topics = Howzit::BuildNote.new(file: file).topics
74
75
  topics.each do |topic|
75
- puts Howzit::Color.template(" {bk}│{bw}-{x} {bcK}#{template}:#{topic.title.sub(/^.*?:/, '')}{x}")
76
+ out.push(Howzit::Color.template(" {bk}│{bw}-{x} {bcK}#{template}:#{topic.title.sub(/^.*?:/, '')}{x}"))
76
77
  end
77
78
  unless metadata.empty?
78
79
  meta = []
79
80
  meta << metadata['required'].split(/\s*,\s*/).map { |m| "*{bw}#{m}{xw}" } if metadata.key?('required')
80
81
  meta << metadata['optional'].split(/\s*,\s*/).map(&:to_s) if metadata.key?('optional')
81
- puts Howzit::Color.template('{bk}[{bl}meta{bk}]───────────────────────────────────────┤{x}')
82
- puts Howzit::Color.template(" {bk}│ {xw}#{meta.join(', ')}{x}")
82
+ out.push(Howzit::Color.template('{bk}[{bl}meta{bk}]───────────────────────────────────────┤{x}'))
83
+ out.push(Howzit::Color.template(" {bk}│ {xw}#{meta.join(', ')}{x}"))
83
84
  end
84
- puts Howzit::Color.template(' {bk}└───────────────────────────────────────────┘{x}')
85
+ out.push(Howzit::Color.template(' {bk}└───────────────────────────────────────────┘{x}'))
85
86
  end
87
+ Howzit::Util.page out.join("\n")
86
88
  Process.exit 0
87
89
  end
88
90
 
@@ -13,11 +13,13 @@ module Howzit
13
13
  ## @param file [String] The path to the build note file
14
14
  ##
15
15
  def initialize(file: nil)
16
+ file ||= note_file
17
+
16
18
  @topics = []
17
- create_note(prompt: true) if note_file.nil?
19
+ create_note(prompt: true) if file.nil?
18
20
 
19
- content = Util.read_file(note_file)
20
- raise "{br}No content found in build note (#{note_file}){x}".c if content.nil? || content.empty?
21
+ content = Util.read_file(file)
22
+ raise "{br}No content found in build note (#{file}){x}".c if content.nil? || content.empty?
21
23
 
22
24
  @metadata = content.split(/^#/)[0].strip.get_metadata
23
25
 
@@ -596,7 +598,7 @@ module Howzit
596
598
  lines = sect.split(/\n/)
597
599
  title = lines.slice!(0).strip
598
600
  prefix = ''
599
- if path
601
+ if path && path != note_file
600
602
  if path =~ /#{Howzit.config.template_folder}/
601
603
  short_path = File.basename(path, '.md')
602
604
  else
@@ -3,5 +3,5 @@
3
3
  # Primary module for this gem.
4
4
  module Howzit
5
5
  # Current Howzit version.
6
- VERSION = '2.0.21'
6
+ VERSION = '2.0.22'
7
7
  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: 2.0.21
4
+ version: 2.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra