promptula 0.0.10 → 0.0.11

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.
@@ -1,3 +1,3 @@
1
1
  module Promptula
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/lib/promptula.rb CHANGED
@@ -2,8 +2,6 @@ require "promptula/version"
2
2
  require "rainbow"
3
3
  module Promptula
4
4
 
5
- LEFT_EDGE = "\u25C0"
6
- RIGHT_EDGE = "\u25B6"
7
5
  GLYPH = "\u2733"
8
6
  PULL_ARROW = "\u2798"
9
7
  PUSH_ARROW = "\u279A"
@@ -20,24 +18,26 @@ module Promptula
20
18
  .split("\n")
21
19
  .map {|l| l.split ' '}]
22
20
  status = `git status --ignore-submodules --porcelain`
21
+ user = `git config --get user.initials`.strip
23
22
  untracked = (status.match('\?\?') or '').size > 0 ? " #{GLYPH}" : ''
24
23
  dirty = status.size > 0
25
24
  background = dirty ? :red : :green
26
- prompt = LEFT_EDGE.foreground(background)
27
- prompt += " #{branch}#{untracked} ".foreground(background).background(:white).inverse()
25
+ prompt = '['.foreground(:white).background(background)
26
+ prompt += "#{branch}#{untracked}".foreground(background).background(:white).inverse()
28
27
  remote = tracking[branch]
29
28
  if remote
30
29
  push_pull = `git rev-list --left-right #{remote}...HEAD`.split("\n")
31
30
  to_push = (push_pull.select {|m| m.start_with? '>'}).length
32
31
  to_pull = (push_pull.select {|m| m.start_with? '<'}).length
33
32
  if to_pull > 0
34
- prompt += "#{PULL_ARROW}#{to_pull} ".foreground(background).background(:white).inverse()
33
+ prompt += "#{PULL_ARROW}#{to_pull}".foreground(background).background(:white).inverse()
35
34
  end
36
35
  if to_push > 0
37
- prompt += "#{PUSH_ARROW}#{to_push} ".foreground(background).background(:white).inverse()
36
+ prompt += "#{PUSH_ARROW}#{to_push}".foreground(background).background(:white).inverse()
38
37
  end
39
38
  end
40
- prompt += RIGHT_EDGE.foreground(background)
39
+ prompt += ']'.foreground(:white).background(background)
40
+ prompt += user.foreground(:white).background(background)
41
41
  prompt.chomp
42
42
  else
43
43
  ''
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promptula
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-04 00:00:00.000000000 Z
12
+ date: 2013-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop