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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50e2a9587c1e477ebfba689ac13604b9a10c18669ca8669d90e66b579167f515
4
- data.tar.gz: '099d0e718b8ef7d4a54257158a6ae4b8914309c4ab730aa9bcbb5458b10faf6a'
3
+ metadata.gz: 4847384ea201a976c5bb01448035d0511679bd459b39453b6c9b365dc1115650
4
+ data.tar.gz: 8818fdae95f080c396ec5ea9831b7fd0e5ebf68a47af58cdfbeb3948a35be411
5
5
  SHA512:
6
- metadata.gz: b0527a019699115059a9015ca482b240300cabd85c397b02592ded404b02e85c8cec71cc8e97782578469d3e706e15da855963c828ff4cf3b01e9c5988d373d8
7
- data.tar.gz: 250aec6aeadeadfd87f68f30c1fa8c70c43b46c1f23aac5efb963319756693f5b756eb7bd4f6cfc0c7bb946a782b40d203c3acd0f8f31daa97e4136711215629
6
+ metadata.gz: 04f82ea1c595ede5ad9ec37f33ed5a8c2a7d8e39d6dfaf91b09a5d38e1ec28b7549c5d35d8ef3983c4fe3a85107b9043a3215ab9025ba6312f6a07313fa8d483
7
+ data.tar.gz: e8f1c4bf213d6d7fc375a8a3d29dc8d2c81eff6a31fab970c9bc9852b6d548de4b114794a31743c1907d297dbc10397269437aea6f429dab67e625f395023cc3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 1.1.3
2
+
3
+ - Add --prefs option
4
+
1
5
  ### 1.1.2
2
6
 
3
7
  - Allow app name in x-success if bundle id can't be found
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bunchcli (1.1.1)
4
+ bunchcli (1.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module BunchCLI
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
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.2
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-30 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: