vimgolf-finder 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -1
- data/lib/vimgolf_finder/challenge.rb +1 -1
- data/lib/vimgolf_finder/cli.rb +29 -0
- data/lib/vimgolf_finder/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06a148fd40c696a29a1e25cb9d33eb9dd31c8847
|
4
|
+
data.tar.gz: 32c6ca058282db10a5738bbaca5b4a095dbc73fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c687bf4e0d47d3db3083aa0f66393542d7eba7b9875c805503c62e0f510cc5b5ff3815ed51fb2f8ea2ba06237f682df0bce84c581c70b6087a95b051783db23
|
7
|
+
data.tar.gz: 881ee5e27ac7a2fe5c84216786fc231ad7dacb8f85504f4e2ec2e131f3fdbaf2759b35012fef8aec8aad6f568707b203610e991592660dea78816cf548efe272
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Simple VimGolf challenge finder. It just toy project for me! :smile:
|
|
7
7
|
[![asciicast](https://asciinema.org/a/1whcqi8pjldxi767iiknqxeil.png)](https://asciinema.org/a/1whcqi8pjldxi767iiknqxeil)
|
8
8
|
|
9
9
|
## Installation
|
10
|
-
|
10
|
+
Paste this at a terminal prompt:
|
11
11
|
```
|
12
12
|
$ gem install vimgolf-finder
|
13
13
|
```
|
@@ -96,6 +96,22 @@ Do you want to play? (y/n) y
|
|
96
96
|
|
97
97
|
# Playing VimGolf...
|
98
98
|
|
99
|
+
Thanks for playing!
|
100
|
+
Solves? (y/n) n
|
101
|
+
```
|
102
|
+
|
103
|
+
### Solves 🔎
|
104
|
+
Show solved VimGolf challenges
|
105
|
+
```
|
106
|
+
$ vimgolf-finder solves
|
107
|
+
1. Simple, Practical, and Common - 7953 entries (55b18bbea9c2c30d04000001) [✓]
|
108
|
+
Choose challenge number. 1
|
109
|
+
|
110
|
+
Open your web browser? (y/n) y
|
111
|
+
Do you want to play? (y/n) y
|
112
|
+
|
113
|
+
# Playing VimGolf...
|
114
|
+
|
99
115
|
Thanks for playing!
|
100
116
|
Solves? (y/n) n
|
101
117
|
$
|
@@ -6,7 +6,7 @@ module VimGolfFinder
|
|
6
6
|
|
7
7
|
def print(index = 1)
|
8
8
|
if self.solved?
|
9
|
-
VimGolfFinder.ui.log "#{index}. \e[37m#{self.title}\e[0m - #{self.entries} entries (\e[33m#{self.id}\e[0m) [\u2713]"
|
9
|
+
VimGolfFinder.ui.log "#{index}. \e[37m#{self.title}\e[0m - #{self.entries} entries (\e[33m#{self.id}\e[0m) \e[32m[\u2713]\e[0m"
|
10
10
|
else
|
11
11
|
VimGolfFinder.ui.log "#{index}. \e[37m#{self.title}\e[0m - #{self.entries} entries (\e[33m#{self.id}\e[0m)"
|
12
12
|
end
|
data/lib/vimgolf_finder/cli.rb
CHANGED
@@ -77,6 +77,35 @@ module VimGolfFinder
|
|
77
77
|
play(id)
|
78
78
|
end
|
79
79
|
|
80
|
+
desc 'solves', 'Show solved VimGolf challenges'
|
81
|
+
def solves
|
82
|
+
challenges = VimGolfFinder.parser.fetch_challenges
|
83
|
+
|
84
|
+
solved_challenges = []
|
85
|
+
challenges.each do |challenge|
|
86
|
+
if challenge.solved?
|
87
|
+
solved_challenges << challenge
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
solved_challenges.each_with_index do |challenge, index|
|
92
|
+
challenge.print(index+1)
|
93
|
+
end
|
94
|
+
|
95
|
+
number = VimGolfFinder.ui.ask 'Choose challenge number.'
|
96
|
+
number = number.to_i
|
97
|
+
if number.instance_of? Fixnum
|
98
|
+
if number < 1 or number > solved_challenges.count
|
99
|
+
VimGolfFinder.ui.error 'Invalid number'
|
100
|
+
return
|
101
|
+
end
|
102
|
+
|
103
|
+
id = challenges[number-1].id
|
104
|
+
print_challenge(id)
|
105
|
+
play(id)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
80
109
|
private
|
81
110
|
def print_challenge(id)
|
82
111
|
VimGolfFinder.ui.log ''
|