howzit 2.1.3 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.howzit.taskpaper.bak +27 -0
- data/CHANGELOG.md +16 -0
- data/lib/howzit/colors.rb +46 -21
- data/lib/howzit/config.rb +89 -0
- data/lib/howzit/util.rb +1 -0
- data/lib/howzit/version.rb +1 -1
- data/lib/howzit.rb +28 -24
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1299678fe342467585d3ced3e03840c89964312c17e865beb77bbeb10fd84d5c
|
4
|
+
data.tar.gz: 247e0c2819675d4da66c07e7d80af7cfdcb3a1be461a1fea4df901ca0b924bbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 676fc60b51f92daa8fa61c10ca1d3029e1ac310da7c9dfb9563e40cf090572ccb97cef1384fc2fd7a7e6ef93bd113f6a677d4d61f60ddebf706a9983a0cebafc
|
7
|
+
data.tar.gz: 3c2e3820b771428413019e68510e50eb7ee3423af04c5540974825c0f18a07844af4eb72a1b3a83818195ce0085b5135b6f21cb6b44621da244afb54e2f98843
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Inbox:
|
2
|
+
- Topic summaries @na
|
3
|
+
Maybe in square brackets on line after topic title, or as a blockquote. When doing a list of available topics, include its summary in the output. Ignore or specially style summary when viewing full topic.
|
4
|
+
- Named positional arguments for topics @na
|
5
|
+
Parenthesis after title like a function (arg1, arg2). Variables can have default values (arg1 = testing) and are available as [%var1] replacements in scripts
|
6
|
+
howzit:
|
7
|
+
New Features:
|
8
|
+
Ideas:
|
9
|
+
- Nested topics @maybe @na
|
10
|
+
Allow increased header levels to nest topics within a parent
|
11
|
+
Running/viewing a parent includes all nested subtopics
|
12
|
+
All topics still available via search
|
13
|
+
When reading file, set a base level from first header, then test each additional topic title to see whether it's greater than the current level. If so, change current level and begin collecting subtopics at the same level
|
14
|
+
Howzit::Topic has a subtopic attribute, consisting of an array of Topics. Each of these Topics also has a subtopics attr. These are collected and assigned during initila reading of note file
|
15
|
+
When read in, a topic is added to the top level build notes topic, as well as appended to its parent's subtopics if it's a higher level than the base
|
16
|
+
just need methods to determine base level (first # match) and check the current headers level when discovering a topic (count #)
|
17
|
+
|
18
|
+
no, wait. topics should read in their own children. Determine base header level, split topics at that level, then recurse each topic the same way
|
19
|
+
include statements will need to be adjusted to allow includes as children. Multiple at symbols could indicate the level to nest at, two symbols would indicate that the include belonged to the last parent. When importing, adjust base header levels appropriately (increase 1).
|
20
|
+
Bugs:
|
21
|
+
Archive:
|
22
|
+
- Add a preview when selecting topic with fzf @priority(3) @na @done(2022-08-06) @project(Inbox)
|
23
|
+
Search Definitions:
|
24
|
+
Top Priority @search(@priority = 5 and not @done)
|
25
|
+
High Priority @search(@priority > 3 and not @done)
|
26
|
+
Maybe @search(@maybe)
|
27
|
+
Next @search(@na and not @done and not project = "Archive")
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
### 2.1.5
|
2
|
+
|
3
|
+
2023-04-12 15:13
|
4
|
+
|
5
|
+
#### FIXED
|
6
|
+
|
7
|
+
- Allow tilde in path to editor
|
8
|
+
|
9
|
+
### 2.1.4
|
10
|
+
|
11
|
+
2023-03-07 12:52
|
12
|
+
|
13
|
+
#### NEW
|
14
|
+
|
15
|
+
- A theme file is automatically created where you can change the default output of any color that Howzit outputs. They can be 2-3 digit ANSI escape codes, or '#XXXXXX' RGB hex codes
|
16
|
+
|
1
17
|
### 2.1.3
|
2
18
|
|
3
19
|
2023-03-07 11:21
|
data/lib/howzit/colors.rb
CHANGED
@@ -205,6 +205,49 @@ module Howzit
|
|
205
205
|
@coloring ||= true
|
206
206
|
end
|
207
207
|
|
208
|
+
def translate_rgb(code)
|
209
|
+
return code if code !~ /#[A-Z0-9]{3,6}/i
|
210
|
+
|
211
|
+
rgb(code)
|
212
|
+
end
|
213
|
+
|
214
|
+
##
|
215
|
+
## Generate escape codes for hex colors
|
216
|
+
##
|
217
|
+
## @param hex [String] The hexadecimal color code
|
218
|
+
##
|
219
|
+
## @return [String] ANSI escape string
|
220
|
+
##
|
221
|
+
def rgb(hex)
|
222
|
+
is_bg = hex.match(/^bg?#/) ? true : false
|
223
|
+
hex_string = hex.sub(/^([fb]g?)?#/, '')
|
224
|
+
|
225
|
+
parts = hex_string.match(/(?<r>..)(?<g>..)(?<b>..)/)
|
226
|
+
t = []
|
227
|
+
%w[r g b].each do |e|
|
228
|
+
t << parts[e].hex
|
229
|
+
end
|
230
|
+
|
231
|
+
"\e[#{is_bg ? '48' : '38'};2;#{t.join(';')}"
|
232
|
+
end
|
233
|
+
|
234
|
+
# Merge config file colors into attributes
|
235
|
+
def configured_colors
|
236
|
+
color_file = File.join(File.expand_path(CONFIG_DIR), COLOR_FILE)
|
237
|
+
if File.exist?(color_file)
|
238
|
+
colors = YAML.load(Util.read_file(color_file))
|
239
|
+
return ATTRIBUTES unless !colors.nil? && colors.is_a?(Hash)
|
240
|
+
|
241
|
+
attrs = ATTRIBUTES.to_h
|
242
|
+
attrs = attrs.merge(colors.symbolize_keys)
|
243
|
+
new_colors = {}
|
244
|
+
attrs.each { |k, v| new_colors[k] = translate_rgb(v) }
|
245
|
+
new_colors.to_a
|
246
|
+
else
|
247
|
+
ATTRIBUTES
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
208
251
|
##
|
209
252
|
## Convert a template string to a colored string.
|
210
253
|
## Colors are specified with single letters inside
|
@@ -241,7 +284,9 @@ module Howzit
|
|
241
284
|
end
|
242
285
|
end
|
243
286
|
|
244
|
-
|
287
|
+
# Dynamically generate methods for each color name. Each
|
288
|
+
# resulting method can be called with a string or a block.
|
289
|
+
configured_colors.each do |c, v|
|
245
290
|
new_method = <<-EOSCRIPT
|
246
291
|
# Color string as #{c}
|
247
292
|
def #{c}(string = nil)
|
@@ -288,26 +333,6 @@ module Howzit
|
|
288
333
|
module_eval(new_method)
|
289
334
|
end
|
290
335
|
|
291
|
-
##
|
292
|
-
## Generate escape codes for hex colors
|
293
|
-
##
|
294
|
-
## @param hex [String] The hexadecimal color code
|
295
|
-
##
|
296
|
-
## @return [String] ANSI escape string
|
297
|
-
##
|
298
|
-
def rgb(hex)
|
299
|
-
is_bg = hex.match(/^bg?#/) ? true : false
|
300
|
-
hex_string = hex.sub(/^([fb]g?)?#/, '')
|
301
|
-
|
302
|
-
parts = hex_string.match(/(?<r>..)(?<g>..)(?<b>..)/)
|
303
|
-
t = []
|
304
|
-
%w[r g b].each do |e|
|
305
|
-
t << parts[e].hex
|
306
|
-
end
|
307
|
-
|
308
|
-
"\e[#{is_bg ? '48' : '38'};2;#{t.join(';')}m"
|
309
|
-
end
|
310
|
-
|
311
336
|
# Regular expression that is used to scan for ANSI-sequences while
|
312
337
|
# uncoloring strings.
|
313
338
|
COLORED_REGEXP = /\e\[(?:(?:[349]|10)[0-7]|[0-9])?m/.freeze
|
data/lib/howzit/config.rb
CHANGED
@@ -23,6 +23,45 @@ module Howzit
|
|
23
23
|
wrap: 0
|
24
24
|
}.deep_freeze
|
25
25
|
|
26
|
+
DEFAULT_COLORS = [
|
27
|
+
[:black, 30],
|
28
|
+
[:red, 31],
|
29
|
+
[:green, 32],
|
30
|
+
[:yellow, 33],
|
31
|
+
[:blue, 34],
|
32
|
+
[:magenta, 35],
|
33
|
+
[:purple, 35],
|
34
|
+
[:cyan, 36],
|
35
|
+
[:white, 37],
|
36
|
+
[:bgblack, 40],
|
37
|
+
[:bgred, 41],
|
38
|
+
[:bggreen, 42],
|
39
|
+
[:bgyellow, 43],
|
40
|
+
[:bgblue, 44],
|
41
|
+
[:bgmagenta, 45],
|
42
|
+
[:bgpurple, 45],
|
43
|
+
[:bgcyan, 46],
|
44
|
+
[:bgwhite, 47],
|
45
|
+
[:boldblack, 90],
|
46
|
+
[:boldred, 91],
|
47
|
+
[:boldgreen, 92],
|
48
|
+
[:boldyellow, 93],
|
49
|
+
[:boldblue, 94],
|
50
|
+
[:boldmagenta, 95],
|
51
|
+
[:boldpurple, 95],
|
52
|
+
[:boldcyan, 96],
|
53
|
+
[:boldwhite, 97],
|
54
|
+
[:boldbgblack, 100],
|
55
|
+
[:boldbgred, 101],
|
56
|
+
[:boldbggreen, 102],
|
57
|
+
[:boldbgyellow, 103],
|
58
|
+
[:boldbgblue, 104],
|
59
|
+
[:boldbgmagenta, 105],
|
60
|
+
[:boldbgpurple, 105],
|
61
|
+
[:boldbgcyan, 106],
|
62
|
+
[:boldbgwhite, 107]
|
63
|
+
].to_h.deep_freeze
|
64
|
+
|
26
65
|
##
|
27
66
|
## Initialize a config object
|
28
67
|
##
|
@@ -39,6 +78,15 @@ module Howzit
|
|
39
78
|
File.open(config_file, 'w') { |f| f.puts config.to_yaml }
|
40
79
|
end
|
41
80
|
|
81
|
+
##
|
82
|
+
## Write a theme to a file
|
83
|
+
##
|
84
|
+
## @param config The configuration
|
85
|
+
##
|
86
|
+
def write_theme(config)
|
87
|
+
File.open(theme_file, 'w') { |f| f.puts config.to_yaml }
|
88
|
+
end
|
89
|
+
|
42
90
|
##
|
43
91
|
## Test if a file should be ignored based on YAML file
|
44
92
|
##
|
@@ -105,6 +153,7 @@ module Howzit
|
|
105
153
|
}
|
106
154
|
|
107
155
|
config = load_config
|
156
|
+
load_theme
|
108
157
|
@options = flags.merge(config)
|
109
158
|
end
|
110
159
|
|
@@ -126,6 +175,15 @@ module Howzit
|
|
126
175
|
File.join(config_dir, CONFIG_FILE)
|
127
176
|
end
|
128
177
|
|
178
|
+
##
|
179
|
+
## Get the theme file
|
180
|
+
##
|
181
|
+
## @return [String] path to config file
|
182
|
+
##
|
183
|
+
def theme_file
|
184
|
+
File.join(config_dir, COLOR_FILE)
|
185
|
+
end
|
186
|
+
|
129
187
|
##
|
130
188
|
## Get the ignore config file
|
131
189
|
##
|
@@ -153,6 +211,24 @@ module Howzit
|
|
153
211
|
config_file
|
154
212
|
end
|
155
213
|
|
214
|
+
##
|
215
|
+
## Create a new config file (and directory if needed)
|
216
|
+
##
|
217
|
+
## @param default [Hash] default configuration to write
|
218
|
+
##
|
219
|
+
def create_theme(default)
|
220
|
+
unless File.directory?(config_dir)
|
221
|
+
Howzit::ConsoleLogger.new(1).info "Creating theme directory at #{config_dir}"
|
222
|
+
FileUtils.mkdir_p(config_dir)
|
223
|
+
end
|
224
|
+
|
225
|
+
unless File.exist?(theme_file)
|
226
|
+
Howzit::ConsoleLogger.new(1).info "Writing fresh theme file to #{theme_file}"
|
227
|
+
write_theme(default)
|
228
|
+
end
|
229
|
+
theme_file
|
230
|
+
end
|
231
|
+
|
156
232
|
##
|
157
233
|
## Load the config file
|
158
234
|
##
|
@@ -166,6 +242,19 @@ module Howzit
|
|
166
242
|
newconfig.dup
|
167
243
|
end
|
168
244
|
|
245
|
+
##
|
246
|
+
## Load the theme file
|
247
|
+
##
|
248
|
+
## @return [Hash] configuration object
|
249
|
+
##
|
250
|
+
def load_theme
|
251
|
+
file = create_theme(DEFAULT_COLORS)
|
252
|
+
config = YAML.load(Util.read_file(file))
|
253
|
+
newconfig = config ? DEFAULT_COLORS.merge(config) : DEFAULT_COLORS
|
254
|
+
write_theme(newconfig)
|
255
|
+
newconfig.dup
|
256
|
+
end
|
257
|
+
|
169
258
|
##
|
170
259
|
## Open the config in an editor
|
171
260
|
##
|
data/lib/howzit/util.rb
CHANGED
@@ -39,6 +39,7 @@ module Howzit
|
|
39
39
|
##
|
40
40
|
def command_exist?(command)
|
41
41
|
exts = ENV.fetch('PATHEXT', '').split(::File::PATH_SEPARATOR)
|
42
|
+
command = File.expand_path(command) if command =~ /^~/
|
42
43
|
if Pathname.new(command).absolute?
|
43
44
|
::File.exist?(command) || exts.any? { |ext| ::File.exist?("#{command}#{ext}") }
|
44
45
|
else
|
data/lib/howzit/version.rb
CHANGED
data/lib/howzit.rb
CHANGED
@@ -1,35 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'howzit/version'
|
4
|
-
require_relative 'howzit/prompt'
|
5
|
-
require_relative 'howzit/colors'
|
6
|
-
require_relative 'howzit/stringutils'
|
7
|
-
|
8
|
-
require_relative 'howzit/hash'
|
9
|
-
require_relative 'howzit/console_logger'
|
10
|
-
require_relative 'howzit/util'
|
11
|
-
require_relative 'howzit/config'
|
12
|
-
require_relative 'howzit/task'
|
13
|
-
require_relative 'howzit/topic'
|
14
|
-
require_relative 'howzit/buildnote'
|
15
|
-
|
16
|
-
require 'optparse'
|
17
|
-
require 'shellwords'
|
18
|
-
require 'pathname'
|
19
|
-
require 'readline'
|
20
|
-
require 'tempfile'
|
21
|
-
require 'yaml'
|
22
|
-
|
23
|
-
require 'tty/screen'
|
24
|
-
require 'tty/box'
|
25
|
-
# require 'tty/prompt'
|
26
|
-
|
27
3
|
# Main config dir
|
28
4
|
CONFIG_DIR = '~/.config/howzit'
|
29
5
|
|
30
6
|
# Config file name
|
31
7
|
CONFIG_FILE = 'howzit.yaml'
|
32
8
|
|
9
|
+
# Color template name
|
10
|
+
COLOR_FILE = 'theme.yaml'
|
11
|
+
|
33
12
|
# Ignore file name
|
34
13
|
IGNORE_FILE = 'ignore.yaml'
|
35
14
|
|
@@ -42,6 +21,31 @@ MULTIPLE_OPTIONS = %w[first best all choose].freeze
|
|
42
21
|
# Available options for header formatting
|
43
22
|
HEADER_FORMAT_OPTIONS = %w[border block].freeze
|
44
23
|
|
24
|
+
require 'optparse'
|
25
|
+
require 'shellwords'
|
26
|
+
require 'pathname'
|
27
|
+
require 'readline'
|
28
|
+
require 'tempfile'
|
29
|
+
require 'yaml'
|
30
|
+
|
31
|
+
require_relative 'howzit/util'
|
32
|
+
require_relative 'howzit/hash'
|
33
|
+
|
34
|
+
require_relative 'howzit/version'
|
35
|
+
require_relative 'howzit/prompt'
|
36
|
+
require_relative 'howzit/colors'
|
37
|
+
require_relative 'howzit/stringutils'
|
38
|
+
|
39
|
+
require_relative 'howzit/console_logger'
|
40
|
+
require_relative 'howzit/config'
|
41
|
+
require_relative 'howzit/task'
|
42
|
+
require_relative 'howzit/topic'
|
43
|
+
require_relative 'howzit/buildnote'
|
44
|
+
|
45
|
+
require 'tty/screen'
|
46
|
+
require 'tty/box'
|
47
|
+
# require 'tty/prompt'
|
48
|
+
|
45
49
|
# Main module for howzit
|
46
50
|
module Howzit
|
47
51
|
class << self
|
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.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -292,6 +292,7 @@ extra_rdoc_files: []
|
|
292
292
|
files:
|
293
293
|
- ".editorconfig"
|
294
294
|
- ".gitignore"
|
295
|
+
- ".howzit.taskpaper.bak"
|
295
296
|
- ".rspec"
|
296
297
|
- ".rubocop.yml"
|
297
298
|
- ".travis.yml"
|