djinni 2.0.0 → 2.0.1

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: b0c26461a62d30afb00ae7a1cb72b76f0ef55b9e
4
- data.tar.gz: 7dbdea06e28da92e6511031b88a3d286c7eb2481
3
+ metadata.gz: 9e662c2bb1aff1c1aac6c4a445e14a37084347cd
4
+ data.tar.gz: 8403c6d023b124f228c48d853dbf58e398a9876e
5
5
  SHA512:
6
- metadata.gz: fc6041f1be04c2b4644eb3efea8dd137d207a843ab10aa65aa98b8e3d4dfc2e13df984056eaa4a59d76a692907a0ca87928378128aaf219fb98214db6b9b23e4
7
- data.tar.gz: dcc88eb053727c0f5e4b4a2d28b40c76a5bc3df4779fac764a7b9e1c606d916a9d3f306e2bf4ad1f19371aff71ab0101b0834c82e7dbda018a8cc6e6ce39df40
6
+ metadata.gz: 762e97138d90e73b69249a24cdbe4daca17e7aaa76facaecaffef7d49f8ca0edc39c637b924ca6feaebb697598c2dd602b1e7aadc0526926c3640076b1f43563
7
+ data.tar.gz: 1ea3b7384cc98aac18c8539149615e8a448d82c6ad32bcd9d14a840caa9844e5b3e1255c0ec49741b131b4e5963061f9356992df6b1b56b4e19cf1b1f1bbf5f7
@@ -1,5 +1,3 @@
1
- require "string"
2
-
3
1
  class Djinni::Wish::History < Djinni::Wish
4
2
  def aliases
5
3
  return ["hist", "history"]
@@ -49,7 +47,7 @@ class Djinni::Wish::History < Djinni::Wish
49
47
 
50
48
  def tab_complete(input, djinni_env = {})
51
49
  history = djinni_env["djinni_history"]
52
- input, last = input.rsplit(" ")
50
+ input, found, last = input.rpartition(" ")
53
51
  included = input.split(" ")
54
52
 
55
53
  completions = Hash.new
@@ -62,7 +60,7 @@ class Djinni::Wish::History < Djinni::Wish
62
60
  !included.include?(item)
63
61
  end
64
62
 
65
- if (last && !last.empty?)
63
+ if (!last.empty?)
66
64
  completions.keep_if do |item, desc|
67
65
  item.downcase.start_with?(last.downcase)
68
66
  end
data/lib/djinni.rb CHANGED
@@ -59,7 +59,9 @@ class Djinni
59
59
  completions.each do |item, desc|
60
60
  fill = Array.new(max + 4 - item.length, " ").join
61
61
  nlfill = Array.new(max + 4, " ").join
62
- lines = desc.word_wrap(80 - (max + 4)).split("\n")
62
+ lines = desc.scan(
63
+ /\S.{0,#{80 - (max + 4)}}\S(?=\s|$)|\S+/
64
+ )
63
65
 
64
66
  if (lines.empty?)
65
67
  puts "#{item}"
@@ -94,9 +96,9 @@ class Djinni
94
96
  end.each do |aliaz, w|
95
97
  fill = Array.new(max + 4 - aliaz.length, " ").join
96
98
  nlfill = Array.new(max + 4, " ").join
97
- lines = w.description.word_wrap(
98
- 80 - (max + 4)
99
- ).split("\n")
99
+ lines = w.description.scan(
100
+ /\S.{0,#{80 - (max + 4)}}\S(?=\s|$)|\S+/
101
+ )
100
102
 
101
103
  if (lines.empty?)
102
104
  puts "#{aliaz}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: djinni
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2016-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -106,7 +106,6 @@ files:
106
106
  - lib/djinni/wish/help.rb
107
107
  - lib/djinni/wish/history.rb
108
108
  - lib/djinni/wish/quit.rb
109
- - lib/string.rb
110
109
  homepage: https://mjwhitta.github.io/djinni
111
110
  licenses:
112
111
  - GPL-3.0
data/lib/string.rb DELETED
@@ -1,12 +0,0 @@
1
- # Modify String class to allow for rsplit and word wrap
2
- class String
3
- def rsplit(pattern)
4
- ret = rpartition(pattern)
5
- ret.delete_at(1)
6
- return ret
7
- end
8
-
9
- def word_wrap(width = 80)
10
- return scan(/\S.{0,#{width}}\S(?=\s|$)|\S+/).join("\n")
11
- end
12
- end