omnibar 0.0.2 → 0.0.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
  SHA1:
3
- metadata.gz: cde2fe41dbe7f67c545e0f41a77a37fd17e09297
4
- data.tar.gz: a58f27bc5c2cc0a6f84c5132e90a4390d433e923
3
+ metadata.gz: 24f7677005fd87a28c0d3bb2d9fbb462b22d4d68
4
+ data.tar.gz: 1eaf5de0c345a7e64eaa9b029e9d489d40537891
5
5
  SHA512:
6
- metadata.gz: 2266d2f38a91eabf847239b609657f8056bfc5a1ab1c74a3acae3926844d17520428603385b23bd40ca110bb7952c0212e5e0e9cdbb97397768f13e8d0853b8c
7
- data.tar.gz: 9143be880598bc1c52b20a9d7b42653be93db7826b28c141769c75ea9c022bfa9a6ebf6c6bd538ef0b574cc94beae6423c5c515efd84f316ccec5d1ab54d1243
6
+ metadata.gz: 4883f22dee50d40b30d002303ba70b27e5550c14c25e444adb79e5708a9e6727ccf6b2c727e385ea1a83e0e4a43f1741d1b6cf432564efa1454c35bd89f017d6
7
+ data.tar.gz: 2f65245d5dc3b705beef56f8843f932e94e70f73416346b270f1f799b42cc342639d5e44a5ae3c97fed9e48b652422cea3fe9d4a04ee59ccae675cc3ae62eab9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omnibar (0.0.1)
4
+ omnibar (0.0.2)
5
5
  dry-configurable (~> 0.7.0)
6
6
 
7
7
  GEM
data/lib/omnibar.rb CHANGED
@@ -16,6 +16,19 @@ module Omnibar
16
16
  setting :repos, []
17
17
  end
18
18
 
19
+ setting :render do
20
+ setting :prompt, ->(width) { ('-' * width) << '>' }
21
+
22
+ setting :highlight do
23
+ setting :fg, :black
24
+ setting :bg, :yellow
25
+ end
26
+ end
27
+
28
+ setting :events do
29
+ setting :after_perform, -> {}
30
+ end
31
+
19
32
  def self.load_config
20
33
  load File.expand_path('~/.omnibar')
21
34
  rescue LoadError => _
data/lib/omnibar/app.rb CHANGED
@@ -67,6 +67,7 @@ module Omnibar
67
67
  def perform_action!
68
68
  visible_queries[selection]&.perform!
69
69
  self.input = ""
70
+ Omnibar.config.events.after_perform.call
70
71
  # TODO: after_perform callback
71
72
  end
72
73
 
@@ -19,14 +19,22 @@ module Omnibar
19
19
  rpad(result.last, ANSI.size[:width] - max_label_length - 2)
20
20
  ].join(': ')
21
21
 
22
- text = ANSI.color(text, fg: :black, bg: :yellow) if i == selection
22
+ if i == selection
23
+ text = ANSI.color(text,
24
+ fg: Omnibar.config.render.highlight.fg,
25
+ bg: Omnibar.config.render.highlight.bg)
26
+ end
23
27
  print "#{text}\r\n"
24
28
  end
25
29
  ANSI.move_cursor(0, input_line.length)
26
30
  end
27
31
 
28
32
  def input_line
29
- ('-' * max_label_length) << '> ' << input
33
+ prompt = Omnibar.config.render.prompt
34
+ if prompt.respond_to?(:call)
35
+ prompt = prompt.call(max_label_length)
36
+ end
37
+ "#{prompt} #{input}"
30
38
  end
31
39
 
32
40
  def rpad(text, length = ANSI.size[:width])
@@ -1,3 +1,3 @@
1
1
  module Omnibar
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnibar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Evan Shreve
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-03 00:00:00.000000000 Z
11
+ date: 2017-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable