gm-notepad 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/README.md +58 -13
- data/exe/gm-notepad +2 -2
- data/lib/gm/notepad/line_evaluator.rb +1 -1
- data/lib/gm/notepad/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce5817b9b619d272b6b534d4da74e9474fb15a5cbfc1dd21ac1094ec2aed844d
|
4
|
+
data.tar.gz: a82515600b627a7b0227305cb7430a548d53d0bdf006b633390da5da80c9af8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c0eb020328774f1e4395f4609fef3da8bd15957f1a97acba14d2d492eee854322d7288ad55ee486ee39774464134f34a3ce9e4150900aa966913a78a4665d00
|
7
|
+
data.tar.gz: 54da4151c52a779dd42324efe1520e066db65c696e108ccf2780c5f756f9b97f84bb66a3538d43b229d2f8973c818c45e1e390defe69600c45d867470e8db293
|
data/README.md
CHANGED
@@ -2,14 +2,6 @@
|
|
2
2
|
|
3
3
|
A command-line tool to help with your GM-ing.
|
4
4
|
|
5
|
-
## Todo
|
6
|
-
|
7
|
-
- [ ] Colorize puts to `interactive` buffer
|
8
|
-
- [ ] Normalize `WriteToTableHandler` to use a renderer
|
9
|
-
- [ ] Normalize `WriteToTableHandler` to deliver on `grep` and `index` behavior
|
10
|
-
- [ ] Gracefully handle requesting an entry from a table with an index that does not exist (e.g. with test data try `+name[23]`)
|
11
|
-
- [ ] Gracefully handle `+name[]`, where "name" is a registered table
|
12
|
-
|
13
5
|
## To install
|
14
6
|
|
15
7
|
`$ gem install gm-notepad`
|
@@ -44,10 +36,9 @@ Examples:
|
|
44
36
|
Specific options:
|
45
37
|
--timestamp Append a timestamp to the note (Default: false)
|
46
38
|
-c, --config_reporting Dump the configuration data (Default: false)
|
47
|
-
-d, --defer_output Defer output until system close (Default:
|
39
|
+
-d, --defer_output Defer output until system close (Default: false)
|
48
40
|
-p, --path=PATH Path for {table_name}.<config.table_extension> files (Default: ["."])
|
49
|
-
-
|
50
|
-
--table_extension
|
41
|
+
-t, --table_extension=EXT Path for {table_name}.<config.table_extension> files (Default: ".txt")
|
51
42
|
-l, --list_tables List tables loaded (Default: nil)
|
52
43
|
-h, --help You're looking at it!
|
53
44
|
```
|
@@ -60,8 +51,8 @@ Which writes the following to the `interactive` buffer (eg. `$stderr`)::
|
|
60
51
|
|
61
52
|
```console
|
62
53
|
=> # Configuration Parameters:
|
63
|
-
=> # config[:config_reporting] =
|
64
|
-
=> # config[:defer_output] =
|
54
|
+
=> # config[:config_reporting] = false
|
55
|
+
=> # config[:defer_output] = false
|
65
56
|
=> # config[:interactive_buffer] = #<IO:<STDERR>>
|
66
57
|
=> # config[:output_buffer] = #<IO:<STDOUT>>
|
67
58
|
=> # config[:paths] = ["."]
|
@@ -116,3 +107,57 @@ You now have an interactive shell for `gm-notepad`. Type `?` and hit
|
|
116
107
|
=> [index] - Target a specific 'index'
|
117
108
|
=> {table_name} - expand_line the given 'table_name'
|
118
109
|
```
|
110
|
+
|
111
|
+
Now, let's take look at a table. Again in an active `gm-notepad` session type
|
112
|
+
the following: `+first-name`
|
113
|
+
|
114
|
+
`gm-notepad` will write the following to `interactive` buffer (eg. `$stderr`):
|
115
|
+
|
116
|
+
```console
|
117
|
+
=> Frodo
|
118
|
+
=> Merry
|
119
|
+
=> Pippin
|
120
|
+
=> Sam
|
121
|
+
=> {first-name}Wise
|
122
|
+
```
|
123
|
+
|
124
|
+
These are the five table entries in the `first-name` table. Notice the fifth
|
125
|
+
entry: `{first-name}Wise`. The `{first-name}` references a table named
|
126
|
+
"first-name" (the same on you are looking at). Now type the following in your `gm-notepad`
|
127
|
+
session: `Hello {first-name}`
|
128
|
+
|
129
|
+
`gm-notepad` will read the line and recursively expand the `{first-name}` and
|
130
|
+
write the result to the `interactive` buffer and `output` buffer.
|
131
|
+
|
132
|
+
In the session you might have something like the below:
|
133
|
+
|
134
|
+
```console
|
135
|
+
=> Hello SamWise
|
136
|
+
Hello SamWise
|
137
|
+
```
|
138
|
+
The line with starting with `=>` is the `interactive` buffer. The other line
|
139
|
+
is written to the `output` buffer.
|
140
|
+
|
141
|
+
To wrap up our first session, let's try one more thing. In your `gm-notepad`
|
142
|
+
session type the following: `{first-name} owes [2d6]gp to {first-name}`:
|
143
|
+
|
144
|
+
```console
|
145
|
+
Frodo owes 3gp to SamWise
|
146
|
+
```
|
147
|
+
|
148
|
+
And there you go.
|
149
|
+
|
150
|
+
## Todo
|
151
|
+
|
152
|
+
- [ ] Colorize puts to `interactive` buffer
|
153
|
+
- [ ] Normalize `WriteToTableHandler` to use a renderer
|
154
|
+
- [ ] Normalize `WriteToTableHandler` to deliver on `grep` and `index` behavior
|
155
|
+
- [ ] Gracefully handle requesting an entry from a table with an index that does not exist (e.g. with test data try `+name[23]`)
|
156
|
+
- [ ] Gracefully handle `+name[]`, where "name" is a registered table
|
157
|
+
- [ ] Add time to live for line expansion (to prevent infinite loops)
|
158
|
+
- [ ] Enable "up" and "down" to scroll through history
|
159
|
+
- [ ] Add config that expands dice results while including the requested roll
|
160
|
+
- [ ] Determine feasibility of adding dice to the `{}` expansion syntax (instead of the `[]` syntax)
|
161
|
+
- [ ] Add index name when rendering table entries
|
162
|
+
- [ ] Add force write results to `output`
|
163
|
+
- [ ] Add concept of history
|
data/exe/gm-notepad
CHANGED
@@ -4,7 +4,7 @@ require 'gm/notepad'
|
|
4
4
|
require 'optparse'
|
5
5
|
config = {
|
6
6
|
config_reporting: false,
|
7
|
-
defer_output:
|
7
|
+
defer_output: false,
|
8
8
|
interactive_buffer: $stderr,
|
9
9
|
output_buffer: $stdout,
|
10
10
|
paths: ['.'],
|
@@ -43,7 +43,7 @@ OptionParser.new do |options|
|
|
43
43
|
config[:paths] << path
|
44
44
|
end
|
45
45
|
|
46
|
-
options.on("-
|
46
|
+
options.on("-tEXT", "--table_extension=EXT", String, "Path for {table_name}.<config.table_extension> files (Default: #{config[:table_extension].inspect})") do |table_extension|
|
47
47
|
config[:table_extension] = table_extension
|
48
48
|
end
|
49
49
|
|
@@ -13,7 +13,7 @@ module Gm
|
|
13
13
|
end
|
14
14
|
while match = line.match(DICE_REGEXP)
|
15
15
|
if parsed_dice = Dice.parse(match[:dice])
|
16
|
-
evaluated_dice = "#{parsed_dice.evaluate}
|
16
|
+
evaluated_dice = "#{parsed_dice.evaluate}"
|
17
17
|
else
|
18
18
|
evaluated_dice = "(#{match[:dice]})"
|
19
19
|
end
|
data/lib/gm/notepad/version.rb
CHANGED