cliptic 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +0 -3
- data/Gemfile.lock +1 -1
- data/README.md +59 -45
- data/Rakefile +0 -2
- data/lib/cliptic/config.rb +22 -24
- data/lib/cliptic/interface.rb +3 -0
- data/lib/cliptic/menus.rb +5 -4
- data/lib/cliptic/terminal.rb +2 -1
- data/lib/cliptic/version.rb +1 -3
- data/lib/cliptic/windows.rb +6 -0
- 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: bed7e4167bd109d3595030a840bfa5295f7fefea8306db6a8843e09feb5bf1c5
|
4
|
+
data.tar.gz: 76c18f65f31077f7611d37e94025a2133f272553291a0a1cda68eebb3428966a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26e80fd00217904ed0d081cf8a676c339e82d2c586667ebf8f47daa542fb9b3ec427b8b89bb4860b087b28f555624d03ccfa56fd1d9050bd28dfe4dcaff1968f
|
7
|
+
data.tar.gz: 8c29f4b0fa7ef0c25db0256854917de5b868f3068099588dc423c1aa4aa8f23715c7124d15e5175577b161cf0e2e0109a5587f049aaba6ad9e8960618cba79e7
|
data/CHANGELOG.md
CHANGED
@@ -5,3 +5,14 @@
|
|
5
5
|
## [0.1.1] - 2021-07-11
|
6
6
|
|
7
7
|
- Minor change to fix screen setup bug
|
8
|
+
|
9
|
+
## [0.1.2] - 2021-07-15
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
- Screen setup/config file bug fix
|
13
|
+
* Previously screen resize prompt would not show if screen was too small due to inability to source default colours
|
14
|
+
- Fix earliest date bug
|
15
|
+
- Center the resize prompt
|
16
|
+
|
17
|
+
### Features
|
18
|
+
- Add menu recolour feature
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,20 +1,32 @@
|
|
1
|
-
#
|
1
|
+
# `cliptic`: Crosswords in your Terminal
|
2
2
|
|
3
3
|
![](https://github.com/apexatoll/cliptic-files/blob/master/demo.gif)
|
4
4
|
|
5
|
+
|
5
6
|
- A command-line interface for downloading and playing cryptic crosswords from within the terminal.
|
6
7
|
- Puzzles are sourced from the free crosswords uploaded daily to [Lovatt's][1].
|
7
|
-
-
|
8
|
+
- cliptic is written in Ruby using the ncurses library
|
9
|
+
|
10
|
+
## New to 0.1.2
|
11
|
+
|
12
|
+
### Bug Fixes
|
13
|
+
- Screen setup/config file bug fix
|
14
|
+
* Previously screen resize prompt would not show if screen was too small due to inability to source default colours
|
15
|
+
- Fix earliest date bug (thank you `samtell21` for pointing this out)
|
16
|
+
- Center the resize prompt
|
17
|
+
|
18
|
+
### Features
|
19
|
+
- Add menu recolour feature
|
8
20
|
|
9
21
|
## Features
|
10
22
|
- VIM-like keybindings
|
11
23
|
- Puzzles scraped daily from Lovatt's. Puzzles are cached locally to prevent excessive requests
|
12
24
|
- Progress can be saved to continue puzzles at a later time
|
13
|
-
- Time taken to complete the puzzle is logged on completion of puzzle. High scores can be viewed within
|
25
|
+
- Time taken to complete the puzzle is logged on completion of puzzle. High scores can be viewed within cliptic
|
14
26
|
- Track progress for puzzles released in the last week
|
15
27
|
- Puzzle history is tracked, making it easy to pick up recently played puzzles
|
16
28
|
- Select puzzles to play by date manually (puzzles are available for up to 9 months from release)
|
17
|
-
- Customisation of
|
29
|
+
- Customisation of cliptic's appearance
|
18
30
|
|
19
31
|
## Dependencies
|
20
32
|
|
@@ -31,7 +43,7 @@
|
|
31
43
|
## Installing
|
32
44
|
|
33
45
|
### As a Gem
|
34
|
-
-
|
46
|
+
- cliptic is available as a Ruby Gem. To install, simply run:
|
35
47
|
```bash
|
36
48
|
gem install cliptic
|
37
49
|
```
|
@@ -97,26 +109,26 @@ rake build install
|
|
97
109
|
### Global Commands
|
98
110
|
|
99
111
|
| Command | Action |
|
100
|
-
|
101
|
-
| `^S` | Save current progress (note that progress is saved when exiting puzzles by default)
|
112
|
+
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
113
|
+
| `^S` | Save current progress (note that progress is saved when exiting puzzles by default) |
|
102
114
|
| `^R` | Reveals solution for focussed clue (note that this forfeits adding this puzzle to high scores) |
|
103
115
|
| `^C` | Exit puzzle |
|
104
116
|
| `^E` | Resets timer and progress for puzzle |
|
105
|
-
| `^G` | Mark current progress (only relevant if auto_mark is set to 0)
|
117
|
+
| `^G` | Mark current progress (only relevant if auto_mark is set to 0) |
|
106
118
|
| `^P` | Pause game |
|
107
119
|
|
108
120
|
### Navigation (Normal Mode)
|
109
121
|
- There are several ways to navigate the cells of the cliptic grid in **NORMAL MODE**.
|
110
122
|
|
111
|
-
| Command | Action
|
112
|
-
|
123
|
+
| Command | Action |
|
124
|
+
|--------------------|----------------------------------------------------------------|
|
113
125
|
| `h`, `j`, `k`, `l` | Move cursor left, up, down, right. Arrow keys can also be used |
|
114
|
-
| `(n)w` | Move to (nth) next unsolved clue
|
115
|
-
| `(n)b` | Move to (nth) previous unsolved clue
|
116
|
-
| `e` | Move to end of clue
|
117
|
-
| `<clue number>g` | Move to clue by number
|
118
|
-
| `<cell number>G` | Move to cell by number (not 0 indexed
|
119
|
-
| `TAB` | Swap from across to down clue (or vice versa)
|
126
|
+
| `(n)w` | Move to (nth) next unsolved clue |
|
127
|
+
| `(n)b` | Move to (nth) previous unsolved clue |
|
128
|
+
| `e` | Move to end of clue |
|
129
|
+
| `<clue number>g` | Move to clue by number |
|
130
|
+
| `<cell number>G` | Move to cell by number (not 0 indexed |
|
131
|
+
| `TAB` | Swap from across to down clue (or vice versa) |
|
120
132
|
|
121
133
|
### Entering Text (Insert Mode)
|
122
134
|
|
@@ -128,15 +140,15 @@ rake build install
|
|
128
140
|
|
129
141
|
### Normal Mode
|
130
142
|
|
131
|
-
| Command | Action
|
132
|
-
|
133
|
-
| `I` | Move to the start of the clue and enter insert mode
|
134
|
-
| `a` | Advance one cell and enter insert mode
|
135
|
-
| `c(obj)` | calls d(obj) then enters insert mode
|
143
|
+
| Command | Action |
|
144
|
+
|-----------|-----------------------------------------------------------------------------------------------------|
|
145
|
+
| `I` | Move to the start of the clue and enter insert mode |
|
146
|
+
| `a` | Advance one cell and enter insert mode |
|
147
|
+
| `c(obj)` | calls d(obj) then enters insert mode |
|
136
148
|
| `d(obj)` | delete the object provided after d (may be w for word or l for character) |
|
137
|
-
| `i` | Enter insert mode
|
138
|
-
| `r(char)` | Replaces the character under the cursor with `char`
|
139
|
-
| `x` | deletes the character under the cursor
|
149
|
+
| `i` | Enter insert mode |
|
150
|
+
| `r(char)` | Replaces the character under the cursor with `char` |
|
151
|
+
| `x` | deletes the character under the cursor |
|
140
152
|
|
141
153
|
## Configuration
|
142
154
|
- Cliptic settings can be added to the cliptic.rc file found at `~/.config/cliptic/cliptic.rc`
|
@@ -150,11 +162,11 @@ set <setting> <0/1>
|
|
150
162
|
|
151
163
|
#### Settable Items
|
152
164
|
|
153
|
-
| Item
|
154
|
-
|
155
|
-
| auto_advance | Move to next clue after solve | 1 |
|
156
|
-
| auto_mark | Mark clues as they are entered | 1 |
|
157
|
-
| auto_save
|
165
|
+
| Item | Description | Default |
|
166
|
+
|----------------|--------------------------------|---------|
|
167
|
+
| `auto_advance` | Move to next clue after solve | 1 |
|
168
|
+
| `auto_mark` | Mark clues as they are entered | 1 |
|
169
|
+
| `auto_save` | Save progress on exit | 1 |
|
158
170
|
|
159
171
|
### Colours
|
160
172
|
- Colours are numbered 1-16.
|
@@ -168,22 +180,24 @@ hi <obj> <colour>
|
|
168
180
|
|
169
181
|
#### Settable Items
|
170
182
|
|
171
|
-
| Item
|
172
|
-
|
173
|
-
| active_num
|
174
|
-
| bar
|
175
|
-
| block
|
176
|
-
| box
|
177
|
-
| grid
|
178
|
-
| incorrect
|
179
|
-
| correct
|
180
|
-
| prompt
|
181
|
-
| default
|
182
|
-
| meta
|
183
|
-
| num
|
184
|
-
| logo_text
|
185
|
-
| I
|
186
|
-
| N
|
183
|
+
| Item | Description | Default |
|
184
|
+
|-----------------|----------------------------|---------|
|
185
|
+
| `active_num` | Grid number of active clue | 3 |
|
186
|
+
| `bar` | Top and bottom bars | 16 |
|
187
|
+
| `block` | Grid blocks | 8 |
|
188
|
+
| `box` | Box outlines | 8 |
|
189
|
+
| `grid` | cliptic grids | 8 |
|
190
|
+
| `incorrect` | Incorrect clue attempt | 1 |
|
191
|
+
| `correct` | Correct clue attempt | 2 |
|
192
|
+
| `prompt` | Menu prompt | 3 |
|
193
|
+
| `default` | Default text color | 0 |
|
194
|
+
| `meta` | Clue box metadata | 3 |
|
195
|
+
| `num` | Inactive grid numbers | 8 |
|
196
|
+
| `logo_text` | Logo text color | 3 |
|
197
|
+
| `I` | Insert mode prompt | 15 |
|
198
|
+
| `N` | Normal mode prompt | 12 |
|
199
|
+
| `menu_active` | Active menu option | 15 |
|
200
|
+
| `menu_inactive` | Inactive menu option | 0 |
|
187
201
|
|
188
202
|
## Feedback
|
189
203
|
- Cliptic is still in development
|
data/Rakefile
CHANGED
data/lib/cliptic/config.rb
CHANGED
@@ -3,57 +3,55 @@ module Cliptic
|
|
3
3
|
Dir_Path = "#{Dir.home}/.config/cliptic"
|
4
4
|
File_Path = "#{Dir_Path}/cliptic.rc"
|
5
5
|
class Default
|
6
|
+
def self.set
|
7
|
+
$colors = colors
|
8
|
+
$config = make_bool(config)
|
9
|
+
end
|
10
|
+
private
|
6
11
|
def self.colors
|
7
12
|
{
|
8
13
|
box:8, grid:8, bar:16, logo_grid:8,
|
9
|
-
logo_text:
|
14
|
+
logo_text:3, title:6, stats:6, active_num:3,
|
10
15
|
num:8, block:8, I:15, N:12, correct:2,
|
11
|
-
incorrect:1, meta:3, cluebox:8
|
16
|
+
incorrect:1, meta:3, cluebox:8,
|
17
|
+
menu_active:15, menu_inactive:0
|
12
18
|
}
|
13
19
|
end
|
14
20
|
def self.config
|
15
21
|
{
|
16
|
-
auto_advance:1,
|
17
|
-
auto_mark:1,
|
18
|
-
auto_save:1
|
22
|
+
auto_advance:1, auto_mark:1, auto_save:1
|
19
23
|
}
|
20
24
|
end
|
21
|
-
|
22
|
-
|
23
|
-
attr_reader :colors, :config
|
24
|
-
def initialize
|
25
|
-
$colors = Default.colors
|
26
|
-
$config = Default.config
|
25
|
+
def self.make_bool(hash)
|
26
|
+
hash.each{|k, v| hash[k] = v == 1 }
|
27
27
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
end
|
29
|
+
class Custom < Default
|
30
|
+
def self.set
|
31
|
+
cfg_file_exists? ? read_cfg : gen_cfg_menu.choose_opt
|
32
32
|
end
|
33
33
|
private
|
34
|
-
def read_cfg
|
34
|
+
def self.read_cfg
|
35
35
|
Reader.new.tap do |file|
|
36
|
-
|
36
|
+
key_map.each do |dest, key|
|
37
37
|
dest.merge!(file.read(**key))
|
38
38
|
end
|
39
39
|
end
|
40
|
+
make_bool($config)
|
40
41
|
end
|
41
|
-
def
|
42
|
+
def self.key_map
|
42
43
|
{
|
43
44
|
$colors => {key:"hi"},
|
44
45
|
$config => {key:"set"}
|
45
46
|
}
|
46
47
|
end
|
47
|
-
def cfg_file_exists?
|
48
|
+
def self.cfg_file_exists?
|
48
49
|
File.exist?(File_Path)
|
49
50
|
end
|
50
|
-
def
|
51
|
-
hash.map{|k, v| [k, v == 1]}.to_h
|
52
|
-
end
|
53
|
-
def gen_cfg_menu
|
51
|
+
def self.gen_cfg_menu
|
54
52
|
Cliptic::Interface::Yes_No_Menu.new(
|
55
53
|
yes:->{Generator.new.write},
|
56
|
-
title:"Generate
|
54
|
+
title:"Generate config file?"
|
57
55
|
)
|
58
56
|
end
|
59
57
|
end
|
data/lib/cliptic/interface.rb
CHANGED
data/lib/cliptic/menus.rb
CHANGED
@@ -16,8 +16,9 @@ module Cliptic
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
class Select_Date < Interface::Menu_With_Stats
|
19
|
-
attr_reader :opts
|
19
|
+
attr_reader :opts, :earliest_date
|
20
20
|
def initialize
|
21
|
+
@earliest_date = (Date.today << 9) + 1
|
21
22
|
set_date(date:Date.today)
|
22
23
|
super(height:7, sel:Interface::Date_Selector)
|
23
24
|
end
|
@@ -88,14 +89,14 @@ module Cliptic
|
|
88
89
|
Date.new(date[2], date[1]+1, 1)-1
|
89
90
|
end
|
90
91
|
def check_in_range
|
91
|
-
set_date(date:Date.today)
|
92
|
-
set_date(date:
|
92
|
+
set_date(date:Date.today) if date_late?
|
93
|
+
set_date(date:earliest_date) if date_early?
|
93
94
|
end
|
94
95
|
def date_late?
|
95
96
|
stat_date > Date.today
|
96
97
|
end
|
97
98
|
def date_early?
|
98
|
-
stat_date <
|
99
|
+
stat_date < earliest_date
|
99
100
|
end
|
100
101
|
end
|
101
102
|
class This_Week < Interface::Menu_With_Stats
|
data/lib/cliptic/terminal.rb
CHANGED
data/lib/cliptic/version.rb
CHANGED
data/lib/cliptic/windows.rb
CHANGED
@@ -82,6 +82,12 @@ module Cliptic
|
|
82
82
|
def move(line:nil, col:nil)
|
83
83
|
super(*center_pos(y:y, x:x, line:line, col:col))
|
84
84
|
end
|
85
|
+
def standout
|
86
|
+
color($colors[:menu_active])
|
87
|
+
end
|
88
|
+
def standend
|
89
|
+
color($colors[:menu_inactive])
|
90
|
+
end
|
85
91
|
private
|
86
92
|
def wrap_dims(y:, x:)
|
87
93
|
[y, x].zip(total_dims)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cliptic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Welham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|