howzit 2.0.17 → 2.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa788ff480288582a4473e2bb2fa9388afc98165c9c78b2c90a1bb9b964d7919
4
- data.tar.gz: e3012f8ed229832f7cefa29b1ff9a4d971858886c8c9778ec7fe6a3b74faa181
3
+ metadata.gz: 22f532430daee5c4c7a1d662d959aa5141848be745940e497b0f5d5d920e0739
4
+ data.tar.gz: 4db5982c0f1409754cf41206b747ccc39b02ceacdaf100dc12e32185d8c13602
5
5
  SHA512:
6
- metadata.gz: 893cc81a4db7d7297f8a3d195f6a02bec4a0e419c56ca6a76e97bfbbe49636ef6e6162457f83f914422bb42d5906df8f38a375309d9d5a1b6844d57d488c2e55
7
- data.tar.gz: e286bd61f5d4d4dd9632691c3486a9daa51701aac8c4facd3f5a62d01e871ec0cd06d7ff4ac1f19c0f9ff7d24d6ef1d3b9f812d68aa6d62877c99b5bfed7b261
6
+ metadata.gz: 7d57db8ee804c204c42b1b30fac02bede10a2ec1b46c31aaf33a688a3441c6338e033e568d61eecedf3ec5a0c05087106532504a4c7cfcbff6daf1ccd9efea20
7
+ data.tar.gz: 99d46ccfe0612d10c832e093a6b1f95fd4c48a72750e2375bc67b5bc8c1a017d15580f5806fa90fb47e8aae6db1f31c3fc931fd51d588ce1aa249bddfe875538
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ### 2.0.20
2
+
3
+ 2022-08-08 11:38
4
+
5
+ #### NEW
6
+
7
+ - --hook command for macOS to copy a link to the build note to clipboard
8
+
9
+ #### FIXED
10
+
11
+ - Error on --edit-config
12
+ - Fzf preview empty
13
+
14
+ ### 2.0.19
15
+
16
+ 2022-08-08 06:18
17
+
18
+ #### IMPROVED
19
+
20
+ - Sort options in help output
21
+
22
+ ### 2.0.18
23
+
24
+ 2022-08-08 03:48
25
+
26
+ #### NEW
27
+
28
+ - Use --ask to require confirmation of all tasks when running a topic
29
+
1
30
  ### 2.0.17
2
31
 
3
32
  2022-08-07 06:09
data/bin/howzit CHANGED
@@ -20,6 +20,10 @@ OptionParser.new do |opts|
20
20
 
21
21
  opts.separator " Behavior:\n\n" #=================================================================== BEHAVIOR
22
22
 
23
+ opts.on('--ask', 'Request confirmation for all tasks when running a topic') do
24
+ Howzit.options[:ask] = true
25
+ end
26
+
23
27
  opts.on('--default', 'Answer all prompts with default response') do
24
28
  Howzit.options[:default] = true
25
29
  end
@@ -40,7 +44,7 @@ OptionParser.new do |opts|
40
44
 
41
45
  opts.separator "\n Listing:\n\n" #=================================================================== LISTING
42
46
 
43
- opts.on('-L', '--list-completions', 'List topics for completion') do
47
+ opts.on('-L', '--list-completions', 'List topics (completion-compatible)') do
44
48
  Howzit.options[:list_topics] = true
45
49
  Howzit.options[:list_topic_titles] = true
46
50
  end
@@ -94,11 +98,6 @@ OptionParser.new do |opts|
94
98
  Process.exit 0
95
99
  end
96
100
 
97
- opts.on('--edit-template NAME', 'Create or edit a template') do |template|
98
- Howzit.buildnote.edit_template(template)
99
- Process.exit 0
100
- end
101
-
102
101
  opts.on('--config-get [KEY]', 'Display the configuration settings or setting for a specific key') do |k|
103
102
  if k.nil?
104
103
  Howzit::Config::DEFAULTS.sort_by { |key, _| key }.each do |key, _|
@@ -132,14 +131,21 @@ OptionParser.new do |opts|
132
131
  Process.exit 0
133
132
  end
134
133
 
135
- opts.on('--edit-config', "Edit configuration file using editor (#{Howzit.options[:editor]})") do
134
+ editor = File.basename(Howzit.options[:editor])
135
+ desc = %(Edit buildnotes file in current working directory using editor (#{editor}))
136
+ opts.on('-e', '--edit', desc) do
137
+ Howzit.buildnote.edit
138
+ Process.exit 0
139
+ end
140
+
141
+ config_editor = File.basename(Howzit.options[:config_editor])
142
+ opts.on('--edit-config', "Edit configuration file using editor (#{config_editor})") do
136
143
  Howzit.config.editor
137
144
  Process.exit 0
138
145
  end
139
146
 
140
- desc = %(Edit buildnotes file in current working directory using editor (#{Howzit.options[:config_editor]}))
141
- opts.on('-e', '--edit', desc) do
142
- Howzit.buildnote.edit
147
+ opts.on('--edit-template NAME', 'Create or edit a template') do |template|
148
+ Howzit.buildnote.edit_template(template)
143
149
  Process.exit 0
144
150
  end
145
151
 
@@ -147,6 +153,13 @@ OptionParser.new do |opts|
147
153
  Howzit.options[:grep] = pat
148
154
  end
149
155
 
156
+ if RbConfig::CONFIG['target_os'] =~ /darwin.*/i
157
+ opts.on('--hook', 'Copy a link to the build note file, ready for pasting into Hook.app or other notes') do
158
+ Howzit.buildnote.hook
159
+ Process.exit 0
160
+ end
161
+ end
162
+
150
163
  opts.on('-r', '--run', 'Execute @run, @open, and/or @copy commands for given topic') do
151
164
  Howzit.options[:run] = true
152
165
  end
@@ -72,6 +72,17 @@ module Howzit
72
72
  end
73
73
  end
74
74
 
75
+ ##
76
+ ## Copy a link to the main build note file to clipboard (macOS only)
77
+ ##
78
+ def hook
79
+ title = Util.read_file(note_file).note_title(note_file, 20)
80
+ title = "#{title} build notes"
81
+ url = "[#{title}](file://#{note_file})"
82
+ `echo #{Shellwords.escape(url)}'\\c'|pbcopy`
83
+ Howzit.console.info('Link copied to clipboard.')
84
+ end
85
+
75
86
  ##
76
87
  ## Call grep on all topics, filtering out those that don't match
77
88
  ##
data/lib/howzit/config.rb CHANGED
@@ -74,7 +74,7 @@ module Howzit
74
74
  ## Initiate the editor for the config
75
75
  ##
76
76
  def editor
77
- edit_config(DEFAULTS)
77
+ edit_config
78
78
  end
79
79
 
80
80
  private
@@ -87,6 +87,7 @@ module Howzit
87
87
  def load_options
88
88
  Color.coloring = $stdout.isatty
89
89
  flags = {
90
+ ask: false,
90
91
  choose: false,
91
92
  default: false,
92
93
  for_topic: nil,
data/lib/howzit/prompt.rb CHANGED
@@ -100,7 +100,7 @@ module Howzit
100
100
  "--height=#{height}",
101
101
  '--header="Use tab to mark multiple selections, enter to display/run"',
102
102
  '--prompt="Select a section > "',
103
- '--preview="howzit {}"'
103
+ %(--preview="howzit --no-pager --header-format block --no-color --default --multiple first {}")
104
104
  ]
105
105
  res = `echo #{Shellwords.escape(matches.join("\n"))} | fzf #{settings.join(' ')}`.strip
106
106
  if res.nil? || res.empty?
data/lib/howzit/task.rb CHANGED
@@ -73,9 +73,9 @@ module Howzit
73
73
  matches = Howzit.buildnote.find_topic(@action)
74
74
  raise "Topic not found: #{@action}" if matches.empty?
75
75
 
76
- $stderr.puts "{by}Running tasks from {bw}#{matches[0].title}{x}".c if Howzit.options[:log_level] < 2
76
+ Howzit.console.info("{by}Running tasks from {bw}#{matches[0].title}{x}".c)
77
77
  output.concat(matches[0].run(nested: true))
78
- $stderr.puts "{by}End include: #{matches[0].tasks.count} tasks{x}".c if Howzit.options[:log_level] < 2
78
+ Howzit.console.info("{by}End include: #{matches[0].tasks.count} tasks{x}".c)
79
79
  [output, matches[0].tasks.count]
80
80
  end
81
81
 
@@ -84,7 +84,7 @@ module Howzit
84
84
  ##
85
85
  def run_run
86
86
  title = Howzit.options[:show_all_code] ? @action : @title
87
- $stderr.puts "{bg}Running {bw}#{title}{x}".c if Howzit.options[:log_level] < 2
87
+ Howzit.console.info("{bg}Running {bw}#{title}{x}".c)
88
88
  system(@action)
89
89
  end
90
90
 
@@ -93,7 +93,7 @@ module Howzit
93
93
  ##
94
94
  def run_copy
95
95
  title = Howzit.options[:show_all_code] ? @action : @title
96
- $stderr.puts "{bg}Copied {bw}#{title}{bg} to clipboard{x}".c if Howzit.options[:log_level] < 2
96
+ Howzit.console.info("{bg}Copied {bw}#{title}{bg} to clipboard{x}".c)
97
97
  os_copy(@action)
98
98
  end
99
99
 
@@ -107,21 +107,21 @@ module Howzit
107
107
  out = "{bg}Copying {bw}#{string}".c
108
108
  case os
109
109
  when /darwin.*/i
110
- $stderr.puts "#{out} (macOS){x}".c if Howzit.options[:log_level].zero?
110
+ Howzit.console.debug("#{out} (macOS){x}".c)
111
111
  `echo #{Shellwords.escape(string)}'\\c'|pbcopy`
112
112
  when /mingw|mswin/i
113
- $stderr.puts "#{out} (Windows){x}".c if Howzit.options[:log_level].zero?
113
+ Howzit.console.debug("#{out} (Windows){x}".c)
114
114
  `echo #{Shellwords.escape(string)} | clip`
115
115
  else
116
116
  if 'xsel'.available?
117
- $stderr.puts "#{out} (Linux, xsel){x}".c if Howzit.options[:log_level].zero?
117
+ Howzit.console.debug("#{out} (Linux, xsel){x}".c)
118
118
  `echo #{Shellwords.escape(string)}'\\c'|xsel -i`
119
119
  elsif 'xclip'.available?
120
- $stderr.puts "#{out} (Linux, xclip){x}".c if Howzit.options[:log_level].zero?
120
+ Howzit.console.debug("#{out} (Linux, xclip){x}".c)
121
121
  `echo #{Shellwords.escape(string)}'\\c'|xclip -i`
122
122
  else
123
- $stderr.puts out if Howzit.options[:log_level].zero?
124
- $stderr.puts 'Unable to determine executable for clipboard.'
123
+ Howzit.console.debug(out)
124
+ Howzit.console.warn('Unable to determine executable for clipboard.')
125
125
  end
126
126
  end
127
127
  end
data/lib/howzit/topic.rb CHANGED
@@ -51,7 +51,7 @@ module Howzit
51
51
  end
52
52
 
53
53
  @tasks.each do |task|
54
- if task.optional
54
+ if task.optional || Howzit.options[:ask]
55
55
  note = if task.type == :include
56
56
  task_count = Howzit.buildnote.find_topic(task.action)[0].tasks.count
57
57
  " (#{task_count} tasks)"
@@ -3,5 +3,5 @@
3
3
  # Primary module for this gem.
4
4
  module Howzit
5
5
  # Current Howzit version.
6
- VERSION = '2.0.17'
6
+ VERSION = '2.0.20'
7
7
  end
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.17
4
+ version: 2.0.20
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-07 00:00:00.000000000 Z
11
+ date: 2022-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler