earthquake 0.4.0 → 0.4.1
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.
- data/README.md +13 -3
- data/VERSION +1 -1
- data/earthquake.gemspec +1 -1
- data/lib/earthquake/input.rb +28 -3
- metadata +1 -1
data/README.md
CHANGED
@@ -59,10 +59,12 @@ The blue is excluded.
|
|
59
59
|
|
60
60
|
デバッグモードで動作しているとき、コードの修正は即座に反映される(正確にはコマンドの実行の直前にリロードされる)。
|
61
61
|
|
62
|
-
|
62
|
+
Plugin
|
63
|
+
----
|
63
64
|
|
64
65
|
"~/.earthquake/plugin" is the directory for plugins.
|
65
66
|
At launch, Earthquake try to load files under the directory.
|
67
|
+
プラグインの初期化処理は Earthquake.init のブロックの中で行うべきである。
|
66
68
|
|
67
69
|
### Defining your commands
|
68
70
|
|
@@ -131,13 +133,21 @@ The 'm' is a MatchData.
|
|
131
133
|
end
|
132
134
|
end
|
133
135
|
|
136
|
+
### Defining completion
|
137
|
+
|
138
|
+
Earthquake.init do
|
139
|
+
completion do |text|
|
140
|
+
['@jugyo', 'earthquake', '#eqrb'].grep(/^#{Regexp.quote(text)}/)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
134
144
|
TODO
|
135
145
|
----
|
136
146
|
|
137
|
-
* keyword tracking
|
138
147
|
* more intelligent completion
|
139
|
-
* spec
|
140
148
|
* typable id
|
149
|
+
* keyword highlight
|
150
|
+
* spec
|
141
151
|
|
142
152
|
Copyright
|
143
153
|
----
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/earthquake.gemspec
CHANGED
data/lib/earthquake/input.rb
CHANGED
@@ -9,6 +9,14 @@ module Earthquake
|
|
9
9
|
@command_names ||= []
|
10
10
|
end
|
11
11
|
|
12
|
+
def completions
|
13
|
+
@completions ||= []
|
14
|
+
end
|
15
|
+
|
16
|
+
def completion(&block)
|
17
|
+
completions << block
|
18
|
+
end
|
19
|
+
|
12
20
|
def input(text)
|
13
21
|
begin
|
14
22
|
reload if config[:debug]
|
@@ -55,10 +63,27 @@ module Earthquake
|
|
55
63
|
end
|
56
64
|
|
57
65
|
init do
|
58
|
-
Readline.completion_proc = lambda { |text|
|
59
|
-
command_names.grep /^#{Regexp.quote(text)}/
|
60
|
-
}
|
61
66
|
commands.clear
|
67
|
+
completions.clear
|
68
|
+
|
69
|
+
Readline.basic_word_break_characters = " \t\n\"\\'`$><=;|&{("
|
70
|
+
|
71
|
+
Readline.completion_proc = lambda do |text|
|
72
|
+
completions.inject([]) do |results, completion|
|
73
|
+
begin
|
74
|
+
results + (completion.call(text) || [])
|
75
|
+
rescue Exception => e
|
76
|
+
notify "[ERROR] #{e.message}\n#{e.backtrace.join("\n")}"
|
77
|
+
results
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
completion do |text|
|
83
|
+
if Readline.line_buffer =~ /^\s*#{Regexp.quote(text)}/
|
84
|
+
command_names.grep /^#{Regexp.quote(text)}/
|
85
|
+
end
|
86
|
+
end
|
62
87
|
end
|
63
88
|
|
64
89
|
extend Input
|