howzit 1.2.5 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +170 -7
- data/README.md +6 -4
- data/howzit.gemspec +1 -0
- data/lib/howzit/buildnotes.rb +31 -38
- data/lib/howzit/prompt.rb +16 -0
- data/lib/howzit/stringutils.rb +5 -5
- data/lib/howzit/version.rb +1 -1
- data/lib/howzit.rb +3 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 311a04719d7aa7de00e54224eda363bc249dd6f8e3fdd31ad5d2a625eaa8bff8
|
4
|
+
data.tar.gz: 87f632ce5ac4855880b5d7ddade20983c42b252fa51bbf7fd0b654cf389970ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ef0f06a0d408c652ae516e92d78dbb7d6bd6bf48260cb21dd66e63f4ecf27c38eed30eae42b79c53f87a824e8622b93416aef7e29feae25d2003ed00827332d
|
7
|
+
data.tar.gz: 16025164eb7fb5550058e361fd478b7b37e4e560cbb1b06965c79a9f091df2862d0387cd908cdfcc11456a7b358f3f507ee876036f95190971acdaa610aa979a
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,173 @@
|
|
1
|
-
|
1
|
+
### 1.2.9
|
2
2
|
|
3
|
-
|
4
|
-
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
|
-
This change log follows the conventions of
|
6
|
-
[keep a CHANGELOG](http://keepachangelog.com/).
|
3
|
+
2022-08-01 07:09
|
7
4
|
|
8
|
-
|
5
|
+
### 1.2.8
|
9
6
|
|
10
|
-
|
7
|
+
2022-08-01 07:01
|
8
|
+
|
9
|
+
#### FIXED
|
10
|
+
|
11
|
+
- Frozen string error
|
12
|
+
|
13
|
+
### 1.2.6
|
14
|
+
|
15
|
+
2022-08-01 06:09
|
16
|
+
|
17
|
+
#### NEW
|
18
|
+
|
19
|
+
- Use @before...@end and @after...@end to specify prerequisites and a post-run message. Topics with @before will require y/n verification before running
|
20
|
+
|
21
|
+
#### FIXED
|
22
|
+
|
23
|
+
- ITerm markers weren't being inserted when paging was off
|
24
|
+
|
25
|
+
### 1.2.3
|
26
|
+
|
27
|
+
2022-07-31 14:20
|
28
|
+
|
29
|
+
#### IMPROVED
|
30
|
+
|
31
|
+
- Don't include a topic multiple times in one display
|
32
|
+
- Don't execute nested topics more than once
|
33
|
+
- Indicate nested includes in headers
|
34
|
+
- Code cleanup
|
35
|
+
|
36
|
+
### 1.2.2
|
37
|
+
|
38
|
+
2022-07-31 08:56
|
39
|
+
|
40
|
+
- Add -F option to pager setup (quit if less than one screen)
|
41
|
+
|
42
|
+
### 1.2.1
|
43
|
+
|
44
|
+
2022-07-31 05:12
|
45
|
+
|
46
|
+
- Add handling for delta pager to not clear screen on exit
|
47
|
+
|
48
|
+
### 1.2.0
|
49
|
+
|
50
|
+
2022-07-31 04:59
|
51
|
+
|
52
|
+
- Add grep feature, searches topic/content for pattern and displays matches (selection menu if multiple matches)
|
53
|
+
|
54
|
+
### 1.1.27
|
55
|
+
|
56
|
+
2022-01-17 11:45
|
57
|
+
|
58
|
+
#### NEW
|
59
|
+
|
60
|
+
- Use fzf for menus if available
|
61
|
+
- "@run() TITLE" will show TITLE instead of command when listing runnable topics
|
62
|
+
- @include(FILENAME) will import an external file if the path exists
|
63
|
+
|
64
|
+
### 1.1.26
|
65
|
+
|
66
|
+
- Fix for error in interactive build notes creation
|
67
|
+
|
68
|
+
### 1.1.25
|
69
|
+
|
70
|
+
- Hide run block contents by default
|
71
|
+
- :show_all_code: config setting to include run block contents
|
72
|
+
- --show-code flag to display run block contents at runtime
|
73
|
+
- Modify include display
|
74
|
+
|
75
|
+
### 1.1.24
|
76
|
+
|
77
|
+
- Use ~/.config/howzit/ignore.yaml to ignore patterns when scanning for build notes
|
78
|
+
- Use `required` and `optional` keys in templates to request that metadata be defined when importing
|
79
|
+
- Allow templates to include other templates
|
80
|
+
|
81
|
+
### 1.1.23
|
82
|
+
|
83
|
+
- Add flags to allow content to stay onscreen after exiting pager (less and bat)
|
84
|
+
|
85
|
+
### 1.1.21
|
86
|
+
|
87
|
+
- Merge directive and block handling so execution order is sequential
|
88
|
+
|
89
|
+
### 1.1.20
|
90
|
+
|
91
|
+
- Template functionality for including common tasks/topics
|
92
|
+
|
93
|
+
### 1.1.19
|
94
|
+
|
95
|
+
- Add `--upstream` option to traverse up parent directories for additional build notes
|
96
|
+
|
97
|
+
### 1.1.15
|
98
|
+
|
99
|
+
- Code refactoring/cleanup
|
100
|
+
- Rename "sections" to "topics"
|
101
|
+
- If no match found for topic search, only show error (`:show_all_on_error: false` option)
|
102
|
+
|
103
|
+
### 1.1.14
|
104
|
+
|
105
|
+
- Fix removal of non-alphanumeric characters from titles
|
106
|
+
- -s/--select option to display a menu of all available topics
|
107
|
+
- Allow arguments to be passed after `--` for variable substitution
|
108
|
+
- Allow --matching TYPE to match first non-ambigous keyword match
|
109
|
+
|
110
|
+
### 1.1.13
|
111
|
+
|
112
|
+
- --matching [fuzzy,beginswith,partial,exact] flag
|
113
|
+
- --edit-config flag
|
114
|
+
- sort flags in help
|
115
|
+
|
116
|
+
### 1.1.12
|
117
|
+
|
118
|
+
- After consideration, remove full fuzzy matching. Too many positives for shorter strings.
|
119
|
+
|
120
|
+
### 1.1.11
|
121
|
+
|
122
|
+
- Add full fuzzy matching for topic titles
|
123
|
+
- Add `@include(TOPIC)` command to import another topic's tasks
|
124
|
+
|
125
|
+
### 1.1.10
|
126
|
+
|
127
|
+
- Add config file for default options
|
128
|
+
|
129
|
+
### 1.1.9
|
130
|
+
|
131
|
+
- Use `system` instead of `exec` to allow multiple @run commands
|
132
|
+
- Add code block runner
|
133
|
+
|
134
|
+
### 1.1.8
|
135
|
+
|
136
|
+
- Add `-e/--edit` flag to open build notes in $EDITOR
|
137
|
+
|
138
|
+
### 1.1.7
|
139
|
+
|
140
|
+
- Use `exec` for @run commands to allow interactive processes (e.g. vim)
|
141
|
+
|
142
|
+
### 1.1.6
|
143
|
+
|
144
|
+
- Add option for outputting title with notes
|
145
|
+
- Add option for outputting note title only
|
146
|
+
|
147
|
+
### 1.1.4
|
148
|
+
|
149
|
+
- Fix for "topic not found" when run with no arguments
|
150
|
+
|
151
|
+
### 1.1.1
|
152
|
+
|
153
|
+
- Reorganize and rename long output options
|
154
|
+
- Fix wrapping long lines without spaces
|
155
|
+
|
156
|
+
### 1.1.0
|
157
|
+
|
158
|
+
- Add -R switch for listing "runnable" topics
|
159
|
+
- Add -T switch for completion-compatible listing of "runnable" topics
|
160
|
+
- Add -L switch for completion-compatible listing of all topics
|
161
|
+
|
162
|
+
### 1.0.1
|
163
|
+
|
164
|
+
- Allow topic matching within title, not just at start
|
165
|
+
- Remove formatting of topic text for better compatibility with mdless/mdcat
|
166
|
+
- Add @run() syntax to allow executable commands
|
167
|
+
- Add @copy() syntax to copy text to clipboard
|
168
|
+
- Add @url/@open() syntax to open urls/files, OS agnostic (hopefully)
|
169
|
+
- Add support for mdless/mdcat
|
170
|
+
- Add support for pager
|
171
|
+
- Offer to create skeleton buildnotes if none found
|
172
|
+
- Set iTerm 2 marks for navigation when paging is disabled
|
173
|
+
- Wrap output with option to specify width (default 80, 0 to disable)
|
data/README.md
CHANGED
@@ -2,10 +2,6 @@
|
|
2
2
|
|
3
3
|
[![Gem](https://img.shields.io/gem/v/howzit.svg)](https://rubygems.org/gems/howzit)
|
4
4
|
[![GitHub license](https://img.shields.io/github/license/ttscoff/howzit.svg)](./LICENSE.txt)
|
5
|
-
[![Gemnasium](https://img.shields.io/gemnasium/ttscoff/howzit.svg)](https://gemnasium.com/ttscoff/howzit)
|
6
|
-
[![Travis](https://img.shields.io/travis/ttscoff/howzit.svg)](https://travis-ci.org/ttscoff/howzit)
|
7
|
-
[![Codecov](https://img.shields.io/codecov/c/github/ttscoff/howzit.svg)](https://codecov.io/github/ttscoff/howzit)
|
8
|
-
[![Code Climate](https://img.shields.io/codeclimate/github/ttscoff/howzit.svg)](https://codeclimate.com/github/ttscoff/howzit)
|
9
5
|
|
10
6
|
A command-line reference tool for tracking project build systems
|
11
7
|
|
@@ -91,6 +87,12 @@ You can include commands that can be executed by howzit. Commands start at the b
|
|
91
87
|
- `@include(TOPIC)`
|
92
88
|
|
93
89
|
Includes all tasks from another topic, matching the name (partial match allowed) and returning first match.
|
90
|
+
- `@before...@end`
|
91
|
+
|
92
|
+
A block defined between @before and @end markers will be considered prerequisite for any task the topic can run. If one or more of these blocks exist in the topic, they will be displayed before running and a yes/no dialog will request confirmation that the prerequisites have been met. The content between these markers is still included when viewing the topic, but the tags themselves do not show up in output.
|
93
|
+
- `@after...@end`
|
94
|
+
|
95
|
+
A block defined between @after and @end markers will be displayed after a topic is run. Use it to remind yourself of additional tasks after automated ones have been executed. The content between these markers is still included when viewing the topic, but the tags themselves do not show up in output.
|
94
96
|
|
95
97
|
### Run blocks (embedded scripts)
|
96
98
|
|
data/howzit.gemspec
CHANGED
data/lib/howzit/buildnotes.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Howzit
|
2
2
|
# Primary Class for this module
|
3
3
|
class BuildNotes
|
4
|
+
include Prompt
|
5
|
+
|
4
6
|
attr_accessor :arguments, :metadata
|
5
7
|
|
6
8
|
def topics
|
@@ -108,7 +110,6 @@ module Howzit
|
|
108
110
|
options = {
|
109
111
|
color: true,
|
110
112
|
highlight: false,
|
111
|
-
paginate: false,
|
112
113
|
wrap: 0
|
113
114
|
}
|
114
115
|
|
@@ -124,14 +125,17 @@ module Howzit
|
|
124
125
|
|
125
126
|
output = `echo #{Shellwords.escape(string.strip)}#{pipes}`
|
126
127
|
|
127
|
-
if options[:paginate]
|
128
|
+
if @options[:paginate]
|
128
129
|
page(output)
|
129
130
|
else
|
130
|
-
output.gsub!(/^╌/, '\e]1337;SetMark\a╌') if ENV['TERM_PROGRAM'] =~ /^iTerm/ && !options[:run]
|
131
131
|
puts output
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
def iterm_marker
|
136
|
+
"\e]1337;SetMark\a\n" if ENV['TERM_PROGRAM'] =~ /^iTerm/ && !@options[:run] && !@options[:paginate]
|
137
|
+
end
|
138
|
+
|
135
139
|
def color_single_options(choices = %w[y n])
|
136
140
|
out = []
|
137
141
|
choices.each do |choice|
|
@@ -153,16 +157,9 @@ module Howzit
|
|
153
157
|
end
|
154
158
|
# First make sure there isn't already a buildnotes file
|
155
159
|
if note_file
|
156
|
-
system 'stty cbreak'
|
157
160
|
fname = "\e[1;33m#{note_file}\e[1;37m"
|
158
|
-
|
159
|
-
|
160
|
-
res = $stdin.sysread 1
|
161
|
-
res.chomp!
|
162
|
-
puts
|
163
|
-
system 'stty cooked'
|
164
|
-
|
165
|
-
unless res =~ /y/i
|
161
|
+
res = yn("#{fname} exists and appears to be a build note, continue anyway?", false)
|
162
|
+
unless res
|
166
163
|
puts 'Canceled'
|
167
164
|
Process.exit 0
|
168
165
|
end
|
@@ -209,16 +206,10 @@ module Howzit
|
|
209
206
|
EOBUILDNOTES
|
210
207
|
|
211
208
|
if File.exist?(filename)
|
212
|
-
system 'stty cbreak'
|
213
|
-
yn = color_single_options(%w[y N])
|
214
209
|
file = "\e[1;33m#{filename}"
|
215
|
-
|
216
|
-
res = $stdin.sysread 1
|
217
|
-
res.chomp!
|
218
|
-
puts
|
219
|
-
system 'stty cooked'
|
210
|
+
res = yn("Are you absolutely sure you want to overwrite #{file}", false)
|
220
211
|
|
221
|
-
unless res
|
212
|
+
unless res
|
222
213
|
puts 'Canceled'
|
223
214
|
Process.exit 0
|
224
215
|
end
|
@@ -240,11 +231,11 @@ module Howzit
|
|
240
231
|
|
241
232
|
options.merge!(opts)
|
242
233
|
|
243
|
-
cols =
|
234
|
+
cols = TTY::Screen.columns
|
244
235
|
cols = @options[:wrap] if (@options[:wrap]).positive? && cols > @options[:wrap]
|
245
236
|
title = "\e[#{options[:border]}m#{options[:hr]}#{options[:hr]}( \e[#{options[:color]}m#{title}\e[#{options[:border]}m )"
|
246
237
|
tail = options[:hr] * (cols - title.uncolor.length)
|
247
|
-
"#{title}#{tail}\e[0m"
|
238
|
+
options[:hr] =~ /╌/ ? "#{iterm_marker}#{title}#{tail}\e[0m" : "#{title}#{tail}\e[0m"
|
248
239
|
end
|
249
240
|
|
250
241
|
def os_open(command)
|
@@ -283,6 +274,15 @@ module Howzit
|
|
283
274
|
output = []
|
284
275
|
tasks = 0
|
285
276
|
if topics[key] =~ /(@(include|run|copy|open|url)\((.*?)\)|`{3,}run)/i
|
277
|
+
prereqs = topics[key].scan(/(?<=@before\n).*?(?=\n@end)/im).map(&:strip)
|
278
|
+
postreqs = topics[key].scan(/(?<=@after\n).*?(?=\n@end)/im).map(&:strip)
|
279
|
+
|
280
|
+
unless prereqs.empty?
|
281
|
+
puts prereqs.join("\n\n")
|
282
|
+
res = yn('This task has prerequisites, have they been met?', true)
|
283
|
+
Process.exit 1 unless res
|
284
|
+
|
285
|
+
end
|
286
286
|
directives = topics[key].scan(/(?:@(include|run|copy|open|url)\((.*?)\)|(`{3,})run(?: +([^\n]+))?(.*?)\3)/mi)
|
287
287
|
|
288
288
|
tasks += directives.length
|
@@ -333,6 +333,8 @@ module Howzit
|
|
333
333
|
warn "\e[0;31m--run: No \e[1;31m@directive\e[0;31;40m found in \e[1;37m#{key}\e[0m"
|
334
334
|
end
|
335
335
|
output.push("Ran #{tasks} #{tasks == 1 ? 'task' : 'tasks'}") if @options[:log_level] < 2
|
336
|
+
|
337
|
+
puts postreqs.join("\n\n")
|
336
338
|
end
|
337
339
|
|
338
340
|
# Output a topic with fancy title and bright white text.
|
@@ -349,6 +351,8 @@ module Howzit
|
|
349
351
|
topic.gsub!(/(?mi)^(`{3,})run *([^\n]*)[\s\S]*?\n\1\s*$/, '@@@run \2') unless @options[:show_all_code]
|
350
352
|
topic.split(/\n/).each do |l|
|
351
353
|
case l
|
354
|
+
when /@(before|after|prereq|end)/
|
355
|
+
next
|
352
356
|
when /@include\((.*?)\)/
|
353
357
|
|
354
358
|
m = Regexp.last_match
|
@@ -837,14 +841,9 @@ module Howzit
|
|
837
841
|
raise 'No EDITOR variable defined in environment' if ENV['EDITOR'].nil?
|
838
842
|
|
839
843
|
if note_file.nil?
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
res = $stdin.sysread 1
|
844
|
-
puts
|
845
|
-
system 'stty cooked'
|
846
|
-
|
847
|
-
create_note if res.chomp =~ /^y?$/i
|
844
|
+
res = yn("No build notes file found, create one?", true)
|
845
|
+
|
846
|
+
create_note if res
|
848
847
|
edit_note
|
849
848
|
else
|
850
849
|
`#{ENV['EDITOR']} "#{note_file}"`
|
@@ -1064,14 +1063,8 @@ module Howzit
|
|
1064
1063
|
ARGV.length.times do
|
1065
1064
|
ARGV.shift
|
1066
1065
|
end
|
1067
|
-
|
1068
|
-
|
1069
|
-
$stdout.syswrite "No build notes file found, create one #{yn}? "
|
1070
|
-
res = $stdin.sysread 1
|
1071
|
-
puts
|
1072
|
-
system 'stty cooked'
|
1073
|
-
|
1074
|
-
create_note if res.chomp =~ /^y?$/i
|
1066
|
+
res = yn("No build notes file found, create one?", true)
|
1067
|
+
create_note if res
|
1075
1068
|
Process.exit 1
|
1076
1069
|
end
|
1077
1070
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Howzit
|
4
|
+
module Prompt
|
5
|
+
def yn(prompt, default = true)
|
6
|
+
system 'stty cbreak'
|
7
|
+
yn = color_single_options(default ? %w[Y n] : %w[y N])
|
8
|
+
$stdout.syswrite "\e[1;37m#{prompt} #{yn}\e[1;37m? \e[0m"
|
9
|
+
res = $stdin.sysread 1
|
10
|
+
res.chomp!
|
11
|
+
puts
|
12
|
+
system 'stty cooked'
|
13
|
+
res =~ /y/i
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/howzit/stringutils.rb
CHANGED
@@ -5,7 +5,7 @@ module Howzit
|
|
5
5
|
module StringUtils
|
6
6
|
# Just strip out color codes when requested
|
7
7
|
def uncolor
|
8
|
-
gsub(/\e\[[\d;]+m/, '')
|
8
|
+
gsub(/\e\[[\d;]+m/, '').gsub(/\e]1337;SetMark/,'')
|
9
9
|
end
|
10
10
|
|
11
11
|
# Adapted from https://github.com/pazdera/word_wrap/,
|
@@ -49,11 +49,11 @@ module Howzit
|
|
49
49
|
# Truncate string to nearest word
|
50
50
|
# @param len <number> max length of string
|
51
51
|
def trunc(len)
|
52
|
-
split(/ /).each_with_object(
|
53
|
-
break ob unless ob.length + ' '.length + x.length <= len
|
52
|
+
split(/ /).each_with_object([]) do |x, ob|
|
53
|
+
break ob unless ob.join(' ').length + ' '.length + x.length <= len
|
54
54
|
|
55
|
-
ob
|
56
|
-
end.strip
|
55
|
+
ob.push(x)
|
56
|
+
end.join(' ').strip
|
57
57
|
end
|
58
58
|
|
59
59
|
def trunc!(len)
|
data/lib/howzit/version.rb
CHANGED
data/lib/howzit.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'howzit/version'
|
2
|
+
require 'howzit/prompt'
|
2
3
|
require 'howzit/buildnotes'
|
3
4
|
require 'howzit/stringutils'
|
4
5
|
require 'optparse'
|
@@ -8,6 +9,8 @@ require 'readline'
|
|
8
9
|
require 'tempfile'
|
9
10
|
require 'yaml'
|
10
11
|
|
12
|
+
require 'tty/screen'
|
13
|
+
|
11
14
|
CONFIG_DIR = '~/.config/howzit'
|
12
15
|
CONFIG_FILE = 'howzit.yaml'
|
13
16
|
IGNORE_FILE = 'ignore.yaml'
|
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.
|
4
|
+
version: 1.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
@@ -240,6 +240,20 @@ dependencies:
|
|
240
240
|
- - ">="
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: 1.0.28
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: tty-screen
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - "~>"
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0.8'
|
250
|
+
type: :runtime
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - "~>"
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: '0.8'
|
243
257
|
description: Command line project documentation and task runner
|
244
258
|
email:
|
245
259
|
- me@brettterpstra.com
|
@@ -269,6 +283,7 @@ files:
|
|
269
283
|
- lib/.rubocop.yml
|
270
284
|
- lib/howzit.rb
|
271
285
|
- lib/howzit/buildnotes.rb
|
286
|
+
- lib/howzit/prompt.rb
|
272
287
|
- lib/howzit/stringutils.rb
|
273
288
|
- lib/howzit/version.rb
|
274
289
|
- spec/.rubocop.yml
|