gm-notepad 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/gm/notepad/readline.rb +20 -2
- data/lib/gm/notepad/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b186d6ae4ff1019ca4e0a1c9beab65a156466928024da4b736c021bc70cfa3e9
|
4
|
+
data.tar.gz: 114b921bd96b0e2c4c2b489cbe9412b1e0bf61515fce5b378f61c38ec87ff79f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 587d8929143a4680253c0c0f45ea4ae482df3956c97b85dd5ff6fbb0113af4bb46961c3511bb1eb59b4e8bb4f916958432349d96dbdc93acccda8cafd428353f
|
7
|
+
data.tar.gz: b5cbba4aaf0778ef19f99dbddec1335d0febafd02075539650a9f922a1ad027fa77709386c7f9e18df2b59fcd9bbe51f95fb70badfab3bb70eec2ddf71523ffa
|
data/README.md
CHANGED
@@ -208,8 +208,8 @@ numbers. And you can mix numbers and text. This example introduces the idea of
|
|
208
208
|
columns. _I am still working on retrieving by column names as well as rendering column names_.
|
209
209
|
|
210
210
|
```console
|
211
|
-
|
212
|
-
|
211
|
+
[grell] Grell 15 12D12
|
212
|
+
[jehat] Jehat 19 14D6
|
213
213
|
```
|
214
214
|
|
215
215
|
You can write a new table, without exiting `gm-notepad`, by doing the following:
|
@@ -241,6 +241,7 @@ You can then immediately access the `junk` table, by typing the following: `+jun
|
|
241
241
|
|
242
242
|
## Todo
|
243
243
|
|
244
|
+
- [ ] When printing tables, also print column names/indices
|
244
245
|
- [X] Colorize puts to `interactive` buffer
|
245
246
|
- [X] Disable colors as a configuration option
|
246
247
|
- [ ] Write expected interface document
|
data/lib/gm/notepad/readline.rb
CHANGED
@@ -4,10 +4,28 @@ module Gm
|
|
4
4
|
# A configuration module for the Readline module
|
5
5
|
module Readline
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
QUERY_TABLE_NAMES_PREFIX = /^\+(?<table_name>.*)/.freeze
|
8
|
+
TABLE_EXPANSION_REGEXP = %r{(?<table_container>\{(?<table_name>.*))}.freeze
|
9
|
+
def self.completion_function(string, table_registry: Container.resolve(:table_registry))
|
10
|
+
entries = []
|
11
|
+
if match = string.match(QUERY_TABLE_NAMES_PREFIX)
|
12
|
+
entries += table_registry.table_names.grep(/^#{Regexp.escape(match[:table_name])}/).map { |name| "+#{name}" }
|
13
|
+
end
|
14
|
+
if match = string.match(TABLE_EXPANSION_REGEXP)
|
15
|
+
test_string = string.sub(match[:table_container], "{")
|
16
|
+
entries += table_registry.table_names.grep(/^#{Regexp.escape(match[:table_name])}/).map { |name| "#{test_string}#{name}}"}
|
17
|
+
end
|
18
|
+
entries += history_for(string)
|
19
|
+
entries.uniq.sort
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.history_for(string)
|
9
23
|
::Readline::HISTORY.grep(/^#{Regexp.escape(string)}/)
|
10
24
|
end
|
25
|
+
|
26
|
+
# Check history for existing matches
|
27
|
+
completion_function = method(:completion_function)
|
28
|
+
|
11
29
|
if ::Readline.respond_to?("basic_word_break_characters=")
|
12
30
|
::Readline.basic_word_break_characters= " \t\n`><=;|&{("
|
13
31
|
end
|
data/lib/gm/notepad/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gm-notepad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dice_parser
|