howzit 2.0.20 → 2.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/README.md +1 -1
- data/bin/howzit +12 -12
- data/fish/completions/howzit.fish +1 -0
- data/lib/howzit/buildnote.rb +10 -7
- data/lib/howzit/task.rb +2 -57
- data/lib/howzit/util.rb +55 -0
- data/lib/howzit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aef13e763de59e83d14808c8778e5941c43b1b68669d09a9047dd53aaff60b38
|
4
|
+
data.tar.gz: 0f4052f07e44bbe1b9679a021abd147bc0830941351221baa61cb09f6bfe25c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69231c5b96a7c011710787d6f47ef628286a5b7237489c6220f1bc25a9aab2d76d70f438b9d1872e2531710f100b3d09f715acabb138c7a8cfc6967d6dde9f70
|
7
|
+
data.tar.gz: 49c1e9266d4401d8ca863a9f107ab4e2c2722db719ab253b03db1b1c8983aeb83e3c715971d15be5ebe42d074f79b4ee521a9062a216422023c9884123555646
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
### 2.0.23
|
2
|
+
|
3
|
+
2022-08-09 05:51
|
4
|
+
|
5
|
+
#### FIXED
|
6
|
+
|
7
|
+
- --grep function regression
|
8
|
+
|
9
|
+
### 2.0.22
|
10
|
+
|
11
|
+
2022-08-08 13:49
|
12
|
+
|
13
|
+
#### IMPROVED
|
14
|
+
|
15
|
+
- Paginate output of --templates
|
16
|
+
|
17
|
+
#### FIXED
|
18
|
+
|
19
|
+
- --templates attempting to create new build note
|
20
|
+
- Fix handling of paths when the same as note_file
|
21
|
+
|
22
|
+
### 2.0.21
|
23
|
+
|
24
|
+
2022-08-08 13:16
|
25
|
+
|
26
|
+
#### IMPROVED
|
27
|
+
|
28
|
+
- Use os-agnostic copy function for --hook
|
29
|
+
- Rename link title for --hook
|
30
|
+
|
1
31
|
### 2.0.20
|
2
32
|
|
3
33
|
2022-08-08 11:38
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Howzit
|
2
2
|
|
3
3
|
[![Gem](https://img.shields.io/gem/v/howzit.svg)](https://rubygems.org/gems/howzit)
|
4
|
-
[![Travis](https://
|
4
|
+
[![Travis](https://api.travis-ci.com/ttscoff/howzit.svg?branch=main)](https://travis-ci.org/makenew/ruby-gem)
|
5
5
|
[![GitHub license](https://img.shields.io/github/license/ttscoff/howzit.svg)](./LICENSE.txt)
|
6
6
|
|
7
7
|
A command-line reference tool for tracking project build systems
|
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
|
-
|
71
|
-
|
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.
|
74
|
+
topics = Howzit::BuildNote.new(file: file).topics
|
74
75
|
topics.each do |topic|
|
75
|
-
|
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
|
-
|
82
|
-
|
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
|
-
|
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
|
|
@@ -153,11 +155,9 @@ OptionParser.new do |opts|
|
|
153
155
|
Howzit.options[:grep] = pat
|
154
156
|
end
|
155
157
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
Process.exit 0
|
160
|
-
end
|
158
|
+
opts.on('--hook', 'Copy a link to the build note file, ready for pasting into Hook.app or other notes') do
|
159
|
+
Howzit.buildnote.hook
|
160
|
+
Process.exit 0
|
161
161
|
end
|
162
162
|
|
163
163
|
opts.on('-r', '--run', 'Execute @run, @open, and/or @copy commands for given topic') do
|
@@ -12,6 +12,7 @@ complete -c howzit -l templates -d "List available templates"
|
|
12
12
|
complete -c howzit -l title-only -d "Output title only"
|
13
13
|
complete -c howzit -s c -l create -d "Create a skeleton build note in the current working directory"
|
14
14
|
complete -c howzit -f -l config-get -d "Display the configuration settings or setting for a specific key"
|
15
|
+
complete -c howzit -f -l hook -d "Copy a link to the build notes file (macOS)"
|
15
16
|
complete -c howzit -f -l config-set -d "Set a config value (must be a valid key)"
|
16
17
|
complete -c howzit -l edit-config -d "Edit configuration file using editor (subl)"
|
17
18
|
complete -c howzit -s e -l edit -d "Edit buildnotes file in current working directory using editor (subl)"
|
data/lib/howzit/buildnote.rb
CHANGED
@@ -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
|
19
|
+
create_note(prompt: true) if file.nil?
|
18
20
|
|
19
|
-
content = Util.read_file(
|
20
|
-
raise "{br}No content found in build note (#{
|
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
|
|
@@ -77,9 +79,9 @@ module Howzit
|
|
77
79
|
##
|
78
80
|
def hook
|
79
81
|
title = Util.read_file(note_file).note_title(note_file, 20)
|
80
|
-
title = "#{title}
|
82
|
+
title = "#{title} project notes"
|
81
83
|
url = "[#{title}](file://#{note_file})"
|
82
|
-
|
84
|
+
Util.os_copy(url)
|
83
85
|
Howzit.console.info('Link copied to clipboard.')
|
84
86
|
end
|
85
87
|
|
@@ -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
|
@@ -689,7 +691,7 @@ module Howzit
|
|
689
691
|
## single topic
|
690
692
|
##
|
691
693
|
def process_topic(topic, run, single: false)
|
692
|
-
new_topic = topic.dup
|
694
|
+
new_topic = topic.is_a?(String) ? find_topic(topic)[0] : topic.dup
|
693
695
|
|
694
696
|
# Handle variable replacement
|
695
697
|
new_topic.content = new_topic.content.render_arguments
|
@@ -791,6 +793,7 @@ module Howzit
|
|
791
793
|
|
792
794
|
if !topic_matches.empty?
|
793
795
|
# If we found a match
|
796
|
+
topic_matches.map! { |topic| topic.is_a?(String) ? find_topic(topic)[0] : topic }
|
794
797
|
topic_matches.each { |topic_match| output.push(process_topic(topic_match, Howzit.options[:run], single: true)) }
|
795
798
|
else
|
796
799
|
# If there's no argument or no match found, output all
|
data/lib/howzit/task.rb
CHANGED
@@ -94,62 +94,7 @@ module Howzit
|
|
94
94
|
def run_copy
|
95
95
|
title = Howzit.options[:show_all_code] ? @action : @title
|
96
96
|
Howzit.console.info("{bg}Copied {bw}#{title}{bg} to clipboard{x}".c)
|
97
|
-
os_copy(@action)
|
98
|
-
end
|
99
|
-
|
100
|
-
##
|
101
|
-
## Platform-agnostic copy-to-clipboard
|
102
|
-
##
|
103
|
-
## @param string [String] The string to copy
|
104
|
-
##
|
105
|
-
def os_copy(string)
|
106
|
-
os = RbConfig::CONFIG['target_os']
|
107
|
-
out = "{bg}Copying {bw}#{string}".c
|
108
|
-
case os
|
109
|
-
when /darwin.*/i
|
110
|
-
Howzit.console.debug("#{out} (macOS){x}".c)
|
111
|
-
`echo #{Shellwords.escape(string)}'\\c'|pbcopy`
|
112
|
-
when /mingw|mswin/i
|
113
|
-
Howzit.console.debug("#{out} (Windows){x}".c)
|
114
|
-
`echo #{Shellwords.escape(string)} | clip`
|
115
|
-
else
|
116
|
-
if 'xsel'.available?
|
117
|
-
Howzit.console.debug("#{out} (Linux, xsel){x}".c)
|
118
|
-
`echo #{Shellwords.escape(string)}'\\c'|xsel -i`
|
119
|
-
elsif 'xclip'.available?
|
120
|
-
Howzit.console.debug("#{out} (Linux, xclip){x}".c)
|
121
|
-
`echo #{Shellwords.escape(string)}'\\c'|xclip -i`
|
122
|
-
else
|
123
|
-
Howzit.console.debug(out)
|
124
|
-
Howzit.console.warn('Unable to determine executable for clipboard.')
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
##
|
130
|
-
## Platform-agnostic open command
|
131
|
-
##
|
132
|
-
## @param command [String] The command
|
133
|
-
##
|
134
|
-
def os_open(command)
|
135
|
-
os = RbConfig::CONFIG['target_os']
|
136
|
-
out = "{bg}Opening {bw}#{command}".c
|
137
|
-
case os
|
138
|
-
when /darwin.*/i
|
139
|
-
Howzit.console.debug "#{out} (macOS){x}".c if Howzit.options[:log_level] < 2
|
140
|
-
`open #{Shellwords.escape(command)}`
|
141
|
-
when /mingw|mswin/i
|
142
|
-
Howzit.console.debug "#{out} (Windows){x}".c if Howzit.options[:log_level] < 2
|
143
|
-
`start #{Shellwords.escape(command)}`
|
144
|
-
else
|
145
|
-
if 'xdg-open'.available?
|
146
|
-
Howzit.console.debug "#{out} (Linux){x}".c if Howzit.options[:log_level] < 2
|
147
|
-
`xdg-open #{Shellwords.escape(command)}`
|
148
|
-
else
|
149
|
-
Howzit.console.debug out if Howzit.options[:log_level] < 2
|
150
|
-
Howzit.console.debug 'Unable to determine executable for `open`.'
|
151
|
-
end
|
152
|
-
end
|
97
|
+
Util.os_copy(@action)
|
153
98
|
end
|
154
99
|
|
155
100
|
##
|
@@ -169,7 +114,7 @@ module Howzit
|
|
169
114
|
when :copy
|
170
115
|
run_copy
|
171
116
|
when :open
|
172
|
-
os_open(@action)
|
117
|
+
Util.os_open(@action)
|
173
118
|
end
|
174
119
|
end
|
175
120
|
|
data/lib/howzit/util.rb
CHANGED
@@ -179,6 +179,61 @@ module Howzit
|
|
179
179
|
puts output
|
180
180
|
end
|
181
181
|
end
|
182
|
+
|
183
|
+
##
|
184
|
+
## Platform-agnostic copy-to-clipboard
|
185
|
+
##
|
186
|
+
## @param string [String] The string to copy
|
187
|
+
##
|
188
|
+
def os_copy(string)
|
189
|
+
os = RbConfig::CONFIG['target_os']
|
190
|
+
out = "{bg}Copying {bw}#{string}".c
|
191
|
+
case os
|
192
|
+
when /darwin.*/i
|
193
|
+
Howzit.console.debug("#{out} (macOS){x}".c)
|
194
|
+
`echo #{Shellwords.escape(string)}'\\c'|pbcopy`
|
195
|
+
when /mingw|mswin/i
|
196
|
+
Howzit.console.debug("#{out} (Windows){x}".c)
|
197
|
+
`echo #{Shellwords.escape(string)} | clip`
|
198
|
+
else
|
199
|
+
if 'xsel'.available?
|
200
|
+
Howzit.console.debug("#{out} (Linux, xsel){x}".c)
|
201
|
+
`echo #{Shellwords.escape(string)}'\\c'|xsel -i`
|
202
|
+
elsif 'xclip'.available?
|
203
|
+
Howzit.console.debug("#{out} (Linux, xclip){x}".c)
|
204
|
+
`echo #{Shellwords.escape(string)}'\\c'|xclip -i`
|
205
|
+
else
|
206
|
+
Howzit.console.debug(out)
|
207
|
+
Howzit.console.warn('Unable to determine executable for clipboard.')
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
##
|
213
|
+
## Platform-agnostic open command
|
214
|
+
##
|
215
|
+
## @param command [String] The command
|
216
|
+
##
|
217
|
+
def os_open(command)
|
218
|
+
os = RbConfig::CONFIG['target_os']
|
219
|
+
out = "{bg}Opening {bw}#{command}".c
|
220
|
+
case os
|
221
|
+
when /darwin.*/i
|
222
|
+
Howzit.console.debug "#{out} (macOS){x}".c if Howzit.options[:log_level] < 2
|
223
|
+
`open #{Shellwords.escape(command)}`
|
224
|
+
when /mingw|mswin/i
|
225
|
+
Howzit.console.debug "#{out} (Windows){x}".c if Howzit.options[:log_level] < 2
|
226
|
+
`start #{Shellwords.escape(command)}`
|
227
|
+
else
|
228
|
+
if 'xdg-open'.available?
|
229
|
+
Howzit.console.debug "#{out} (Linux){x}".c if Howzit.options[:log_level] < 2
|
230
|
+
`xdg-open #{Shellwords.escape(command)}`
|
231
|
+
else
|
232
|
+
Howzit.console.debug out if Howzit.options[:log_level] < 2
|
233
|
+
Howzit.console.debug 'Unable to determine executable for `open`.'
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
182
237
|
end
|
183
238
|
end
|
184
239
|
end
|
data/lib/howzit/version.rb
CHANGED
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: 2.0.
|
4
|
+
version: 2.0.23
|
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-
|
11
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|