pra 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{ChangeLog.md → CHANGELOG.md} +5 -0
- data/README.md +9 -2
- data/lib/pra/curses_window_system.rb +70 -18
- data/lib/pra/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a460b389929e15e19c6350124522f9bee85a82f8
|
4
|
+
data.tar.gz: b5859920cd6119434af70312ce60b49a68d966c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 773f87f111d7ca90b25f8d2a4d9064bec399574c02903822bdb00dda5d50eb7b30dc048b1e8b24184dcbec47072425ac74dec82ed38fbff3356a27e81b2103bb
|
7
|
+
data.tar.gz: f1ef94403694fdb29627534065cc53b95ec3aaf9755251b5b2a1d519401bf81bf59cc2381b5b1838ed64a59127d59931fed140da3dbbc4807facad4786e1e8cf
|
@@ -6,7 +6,12 @@ versions as well as provide a rough history.
|
|
6
6
|
|
7
7
|
#### Next Release
|
8
8
|
|
9
|
+
#### v2.1.0
|
10
|
+
|
11
|
+
* Added filtering of current list of pull requests
|
12
|
+
|
9
13
|
#### v2.0.0
|
14
|
+
|
10
15
|
* Added ability to refresh pull requests
|
11
16
|
* Added pagination when there are more pull requests than can be displayed
|
12
17
|
* Added support for github organizations
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ purposes when pra starts.
|
|
23
23
|
|
24
24
|
## Configuration
|
25
25
|
|
26
|
-
`pra` requires one configuration, `~/.pra.json`, to exist in your home
|
26
|
+
`pra` requires one configuration, `~/.pra/config.json`, to exist in your home
|
27
27
|
directory. The following is an example config that can be used as a starter.
|
28
28
|
*Note:* You will need to replace **your.username**, **your.password**,
|
29
29
|
**your.stash.server**, and the **repositories** and **organizations** sections
|
@@ -130,7 +130,7 @@ authentication enabled.
|
|
130
130
|
Simply go to your GitHub **Account Settings**, select **Applications**, click
|
131
131
|
the **Create new token** button in the **Personal Access Token** section. Give
|
132
132
|
it the name "Pra" and submit. This will generate your personal access token.
|
133
|
-
Then simply put your personal access token in the `~/.pra.json` as your GitHub
|
133
|
+
Then simply put your personal access token in the `~/.pra/config.json` as your GitHub
|
134
134
|
username and "x-oauth-basic" as your GitHub password.
|
135
135
|
|
136
136
|
## Usage
|
@@ -167,6 +167,13 @@ To force a refresh press the `r` key.
|
|
167
167
|
To move between pages press `n` to go to the next page, and `p` to go to the
|
168
168
|
previous page.
|
169
169
|
|
170
|
+
### Filter
|
171
|
+
|
172
|
+
To filter the list of you pull requests you can press `/` and start typing. The
|
173
|
+
list will start filtering as you type. Once you have completed typing your
|
174
|
+
filter you can press `Return` and go back to interacting with the list of pull
|
175
|
+
requests. Refreshing by pressing `r` will clear out the filter.
|
176
|
+
|
170
177
|
### Quit
|
171
178
|
|
172
179
|
If you decide you have had enough and want to exit `pra` press the `q` key.
|
@@ -8,6 +8,8 @@ require 'thread'
|
|
8
8
|
module Pra
|
9
9
|
class CursesWindowSystem < Pra::WindowSystem
|
10
10
|
ENTER_KEY = 10
|
11
|
+
ESC_KEY = 27
|
12
|
+
BACKSPACE_KEY = 127
|
11
13
|
|
12
14
|
def initialize
|
13
15
|
@selected_pull_request_page_index = 0
|
@@ -19,6 +21,8 @@ module Pra
|
|
19
21
|
@last_updated_access_lock = Mutex.new
|
20
22
|
@force_update = true
|
21
23
|
@force_update_access_lock = Mutex.new
|
24
|
+
@filter_mode = false
|
25
|
+
@filter_string = ""
|
22
26
|
end
|
23
27
|
|
24
28
|
def last_updated
|
@@ -72,23 +76,55 @@ module Pra
|
|
72
76
|
def run_loop
|
73
77
|
c = Curses.getch()
|
74
78
|
while (c != 'q') do
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
79
|
+
if @filter_mode
|
80
|
+
case c
|
81
|
+
when ESC_KEY
|
82
|
+
@filter_mode = false
|
83
|
+
@filter_string = ""
|
84
|
+
Curses.setpos(5, 0)
|
85
|
+
Curses.clrtoeol
|
86
|
+
@current_pull_requests = @original_pull_requests.dup
|
87
|
+
@original_pull_requests = nil
|
88
|
+
draw_current_pull_requests
|
89
|
+
when ENTER_KEY
|
90
|
+
@filter_mode = false
|
91
|
+
@filter_string = ""
|
92
|
+
when "\b", BACKSPACE_KEY, Curses::KEY_BACKSPACE
|
93
|
+
@filter_string.chop!
|
94
|
+
output_string(5, 0, "Filter: #{@filter_string}")
|
95
|
+
clear_pull_requests
|
96
|
+
filter_current_pull_requests(@filter_string)
|
97
|
+
when String
|
98
|
+
@filter_string += c
|
99
|
+
output_string(5, 0, "Filter: #{@filter_string}")
|
100
|
+
clear_pull_requests
|
101
|
+
filter_current_pull_requests(@filter_string)
|
102
|
+
end
|
103
|
+
else
|
104
|
+
case c
|
105
|
+
when 'j', Curses::Key::DOWN
|
106
|
+
move_selection_down
|
107
|
+
draw_current_pull_requests
|
108
|
+
when 'k', Curses::Key::UP
|
109
|
+
move_selection_up
|
110
|
+
draw_current_pull_requests
|
111
|
+
when 'r'
|
112
|
+
@force_update = true
|
113
|
+
Curses.setpos(5, 0)
|
114
|
+
Curses.clrtoeol
|
115
|
+
when 'o', ENTER_KEY
|
116
|
+
@state_lock.synchronize {
|
117
|
+
Launchy.open(@current_pull_requests[selected_pull_request_loc].link)
|
118
|
+
}
|
119
|
+
when 'n'
|
120
|
+
load_next_page
|
121
|
+
when 'p'
|
122
|
+
load_prev_page
|
123
|
+
when '/'
|
124
|
+
@filter_mode = true
|
125
|
+
@original_pull_requests = @current_pull_requests.dup
|
126
|
+
output_string(5, 0, "Filter: #{@filter_string}")
|
127
|
+
end
|
92
128
|
end
|
93
129
|
c = Curses.getch()
|
94
130
|
end
|
@@ -123,7 +159,7 @@ module Pra
|
|
123
159
|
|
124
160
|
def display_instructions
|
125
161
|
output_string(0, 0, "Pra: Helping you own pull requests")
|
126
|
-
output_string(1, 0, "quit: q, up: k|#{"\u25B2".encode("UTF-8")}, down: j|#{"\u25BC".encode("UTF-8")}, open: o|#{"\u21A9".encode("UTF-8")}, refresh: r, next page: n, prev page: p")
|
162
|
+
output_string(1, 0, "quit: q, up: k|#{"\u25B2".encode("UTF-8")}, down: j|#{"\u25BC".encode("UTF-8")}, open: o|#{"\u21A9".encode("UTF-8")}, refresh: r, next page: n, prev page: p, filter: /")
|
127
163
|
end
|
128
164
|
|
129
165
|
def move_selection_up
|
@@ -212,6 +248,22 @@ module Pra
|
|
212
248
|
Curses.refresh
|
213
249
|
end
|
214
250
|
|
251
|
+
def filter_current_pull_requests(input_string)
|
252
|
+
pull_reqs = @original_pull_requests.dup.keep_if do |pr|
|
253
|
+
columns.any? do |col|
|
254
|
+
presenter = Pra::CursesPullRequestPresenter.new(pr)
|
255
|
+
pr_attr_value = presenter.send(col[:name])
|
256
|
+
if input_string == input_string.downcase
|
257
|
+
pr_attr_value.to_s.downcase.include?(input_string)
|
258
|
+
else
|
259
|
+
pr_attr_value.to_s.include?(input_string)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
refresh_pull_requests(pull_reqs)
|
265
|
+
end
|
266
|
+
|
215
267
|
def draw_current_pull_requests
|
216
268
|
@state_lock.synchronize {
|
217
269
|
output_string(3, 0, "#{@current_pull_requests.length} Pull Requests @ #{@last_updated} : Page #{@current_page} of #{pull_request_pages}")
|
data/lib/pra/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew De Ponte
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,8 +133,8 @@ extra_rdoc_files: []
|
|
133
133
|
files:
|
134
134
|
- ".gitignore"
|
135
135
|
- ".ruby-version"
|
136
|
+
- CHANGELOG.md
|
136
137
|
- CODE_OF_CONDUCT.md
|
137
|
-
- ChangeLog.md
|
138
138
|
- Gemfile
|
139
139
|
- LICENSE.txt
|
140
140
|
- README.md
|