howzit 2.0.20 → 2.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +1 -1
- data/bin/howzit +3 -5
- data/fish/completions/howzit.fish +1 -0
- data/lib/howzit/buildnote.rb +2 -2
- data/lib/howzit/task.rb +2 -57
- data/lib/howzit/util.rb +55 -0
- data/lib/howzit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7fce97cf829010799ce06890d925d1f7eaff647299398650baf9eb898eb56eb
|
4
|
+
data.tar.gz: 2fb9d03d33bd616c005b164fd4420d837fcb688882f7fe98d9779bfdf3abcb4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3af874f2a2d88af1235d803cdf547e5820f32c817f8dbdc566db7a372ae732593cfeab069ccc759a071e5216e3e62a0a9c63a3c4097255f598efeafcecb70123
|
7
|
+
data.tar.gz: 60a1fdf546e005d8b274269c3a7946017fecdc7adea5d028581bac6e044a03b0e0e8df313e82252c1c56b016984c803320e59bf873602aa1a4e3eabf278976f1
|
data/CHANGELOG.md
CHANGED
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
@@ -153,11 +153,9 @@ OptionParser.new do |opts|
|
|
153
153
|
Howzit.options[:grep] = pat
|
154
154
|
end
|
155
155
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
Process.exit 0
|
160
|
-
end
|
156
|
+
opts.on('--hook', 'Copy a link to the build note file, ready for pasting into Hook.app or other notes') do
|
157
|
+
Howzit.buildnote.hook
|
158
|
+
Process.exit 0
|
161
159
|
end
|
162
160
|
|
163
161
|
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
@@ -77,9 +77,9 @@ module Howzit
|
|
77
77
|
##
|
78
78
|
def hook
|
79
79
|
title = Util.read_file(note_file).note_title(note_file, 20)
|
80
|
-
title = "#{title}
|
80
|
+
title = "#{title} project notes"
|
81
81
|
url = "[#{title}](file://#{note_file})"
|
82
|
-
|
82
|
+
Util.os_copy(url)
|
83
83
|
Howzit.console.info('Link copied to clipboard.')
|
84
84
|
end
|
85
85
|
|
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