John Smith commited on 2022-128 21:44:55
Showing 1 changed files, with 25 additions and 3 deletions.
The deck Recfile used by Memoire is now selected from a DeckFile: line in config.rec , and not by the second argument when invoking Memoire, which now has no effect. When multiple DeckFile: lines exist in config.rec, the user is prompted to pick a deck on each run. Deck paths are relative to the user's home directory.
| ... | ... |
@@ -140,11 +140,33 @@ else |
| 140 | 140 |
end |
| 141 | 141 |
end |
| 142 | 142 |
|
| 143 |
-local deckfname = "example.rec" |
|
| 144 |
-if arg[2] then |
|
| 145 |
- deckfname = arg[2] |
|
| 143 |
+if not config.DeckFile then |
|
| 144 |
+ io.write("No deck files specified -- aborting\n")
|
|
| 145 |
+ os.exit(true, true) |
|
| 146 | 146 |
end |
| 147 | 147 |
|
| 148 |
+if #config.DeckFile > 1 then |
|
| 149 |
+ io.write("Select deck to use (by number):\n")
|
|
| 150 |
+ for i, n in ipairs(config.DeckFile) do |
|
| 151 |
+ io.write(string.format("\t%d. %s\n", i, n))
|
|
| 152 |
+ end |
|
| 153 |
+ local rl = io.read("l")
|
|
| 154 |
+ local si = tonumber(rl) |
|
| 155 |
+ if si and si <= #config.DeckFile and si >= 1 then |
|
| 156 |
+ deckfname = config.DeckFile[si] |
|
| 157 |
+ elseif si then |
|
| 158 |
+ io.write("Selected deck out of range -- aborting\n")
|
|
| 159 |
+ os.exit(true, true) |
|
| 160 |
+ else |
|
| 161 |
+ io.write("Input not a number -- aborting")
|
|
| 162 |
+ os.exit(true, true) |
|
| 163 |
+ end |
|
| 164 |
+else |
|
| 165 |
+ deckfname = config.DeckFile[1] |
|
| 166 |
+end |
|
| 167 |
+ |
|
| 168 |
+deckfname = os.getenv("HOME") .. "/" .. deckfname
|
|
| 169 |
+ |
|
| 148 | 170 |
math.randomseed(os.time()) |
| 149 | 171 |
|
| 150 | 172 |
--[[ |
| 151 | 173 |