bunchcli 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/bin/bunch +6 -0
- data/lib/bunch/bunchCLI.rb +27 -0
- data/lib/bunch/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: 4847384ea201a976c5bb01448035d0511679bd459b39453b6c9b365dc1115650
|
4
|
+
data.tar.gz: 8818fdae95f080c396ec5ea9831b7fd0e5ebf68a47af58cdfbeb3948a35be411
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04f82ea1c595ede5ad9ec37f33ed5a8c2a7d8e39d6dfaf91b09a5d38e1ec28b7549c5d35d8ef3983c4fe3a85107b9043a3215ab9025ba6312f6a07313fa8d483
|
7
|
+
data.tar.gz: e8f1c4bf213d6d7fc375a8a3d29dc8d2c81eff6a31fab970c9bc9852b6d548de4b114794a31743c1907d297dbc10397269437aea6f429dab67e625f395023cc3
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -18,11 +18,13 @@ A CLI for [Bunch.app](https://brettterpstra.com/projects/bunch).
|
|
18
18
|
--snippet Load as snippet
|
19
19
|
--fragment=FRAGMENT Run a specific section
|
20
20
|
--vars=VARS Variables to pass to a snippet, comma-separated
|
21
|
+
--pref Set a preference. Run without argument to list available preferences.
|
21
22
|
-u, --url Output URL instead of opening
|
22
23
|
-i, --interactive Interactively generate a Bunch url
|
23
24
|
--show-config Display configuration values
|
24
25
|
-f, --force-refresh Force refresh cached preferences
|
25
26
|
-h, --help Display this screen
|
27
|
+
-v, --version Display Bunch version
|
26
28
|
|
27
29
|
Usage: `bunch [options] BUNCH_NAME|PATH_TO_FILE`
|
28
30
|
|
data/bin/bunch
CHANGED
@@ -52,6 +52,10 @@ optparse = OptionParser.new do |opts|
|
|
52
52
|
bunch.variables = opt
|
53
53
|
end
|
54
54
|
|
55
|
+
opts.on('--pref', 'Set a preference. Run without argument to list available preferences.') do |opt|
|
56
|
+
bunch.url_method = 'setPref'
|
57
|
+
end
|
58
|
+
|
55
59
|
opts.on('-u', '--url', 'Output URL instead of opening') do |_opt|
|
56
60
|
bunch.show_url = true
|
57
61
|
end
|
@@ -88,6 +92,8 @@ unless ARGV.length > 0
|
|
88
92
|
if STDIN.stat.size > 0
|
89
93
|
bunch.url_method = 'raw'
|
90
94
|
bunch.open(CGI.escape(STDIN.read))
|
95
|
+
elsif bunch.url_method == 'setPref'
|
96
|
+
bunch.list_preferences
|
91
97
|
else
|
92
98
|
puts "CLI for Bunches.app"
|
93
99
|
help
|
data/lib/bunch/bunchCLI.rb
CHANGED
@@ -93,6 +93,8 @@ class Bunch
|
|
93
93
|
%(x-bunch://raw?txt=#{bunch}#{params})
|
94
94
|
elsif url_method == 'snippet'
|
95
95
|
%(x-bunch://snippet?file=#{bunch}#{params})
|
96
|
+
elsif url_method == 'setPref'
|
97
|
+
%(x-bunch://setPref?#{bunch})
|
96
98
|
else
|
97
99
|
%(x-bunch://#{url_method}?bunch=#{bunch[:title]}#{params})
|
98
100
|
end
|
@@ -124,6 +126,18 @@ class Bunch
|
|
124
126
|
(url_method.gsub(/e$/, '') + 'ing').capitalize
|
125
127
|
end
|
126
128
|
|
129
|
+
def list_preferences
|
130
|
+
prefs =<<EOF
|
131
|
+
toggleBunches=[0,1] Allow Bunches to be both opened and closed
|
132
|
+
configDir=[path] Absolute path to Bunches folder
|
133
|
+
singleBunchMode=[0,1] Close open Bunch when opening new one
|
134
|
+
preserveOpenBunches=[0,1] Restore Open Bunches on Launch
|
135
|
+
debugLevel=[0-4] Set the logging level for the Bunch Log
|
136
|
+
EOF
|
137
|
+
puts prefs
|
138
|
+
end
|
139
|
+
|
140
|
+
|
127
141
|
def open(str)
|
128
142
|
# get front app
|
129
143
|
front_app = %x{osascript -e 'tell application "System Events" to return name of first application process whose frontmost is true'}.strip
|
@@ -149,6 +163,19 @@ class Bunch
|
|
149
163
|
warn "Opening snippet"
|
150
164
|
`open '#{_url}'`
|
151
165
|
end
|
166
|
+
elsif @url_method == 'setPref'
|
167
|
+
if str =~ /^(\w+)=([^= ]+)$/
|
168
|
+
_url = url(str)
|
169
|
+
if @show_url
|
170
|
+
$stdout.puts _url
|
171
|
+
else
|
172
|
+
warn "Setting preference #{str}"
|
173
|
+
`open '#{_url}'`
|
174
|
+
end
|
175
|
+
else
|
176
|
+
warn "Invalid key=value pair"
|
177
|
+
Process.exit 1
|
178
|
+
end
|
152
179
|
else
|
153
180
|
bunch = find_bunch(str)
|
154
181
|
unless bunch
|
data/lib/bunch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunchcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|