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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23c9253d91c1ef03c4db29751924f0fbb45e13497aaa9f4625a629a8b5d66ca0
4
- data.tar.gz: 7f9d487042f838d415012a43e5cbb840c820bf256fd322cba313f8610fee3d5c
3
+ metadata.gz: b186d6ae4ff1019ca4e0a1c9beab65a156466928024da4b736c021bc70cfa3e9
4
+ data.tar.gz: 114b921bd96b0e2c4c2b489cbe9412b1e0bf61515fce5b378f61c38ec87ff79f
5
5
  SHA512:
6
- metadata.gz: 013b9c64ade3b19008f1bfda2686df131db92051e0c376de64f9c441ad09368d3b64712a87ab2c82dea69f5e3fd66d0710ef5b59c4190a435c2df2f89f1ce73e
7
- data.tar.gz: e9ae058f45ba1979e75fef183ba0c62c8f184ec6638d76a7d2ae4c28bbae1f286de5c8730118bbc4169dd708f793b386acdc98929790aba8f45c5ae86a1111ad
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
- => [grell] Grell 15 12D12
212
- => [jehat] Jehat 19 14D6
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
@@ -4,10 +4,28 @@ module Gm
4
4
  # A configuration module for the Readline module
5
5
  module Readline
6
6
 
7
- # Check history for existing matches
8
- completion_function = proc do |string|
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
@@ -1,5 +1,5 @@
1
1
  module Gm
2
2
  module Notepad
3
- VERSION = "0.0.15"
3
+ VERSION = "0.0.16"
4
4
  end
5
5
  end
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.15
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-06 00:00:00.000000000 Z
11
+ date: 2019-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dice_parser