tty-editor 0.6.0 → 0.7.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 +17 -1
- data/LICENSE.txt +1 -1
- data/README.md +101 -26
- data/lib/tty/editor.rb +89 -38
- data/lib/tty/editor/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c69c19a05883e0929e4f5432eb4732036b11866419842e7e9b08906de54d1fb
|
4
|
+
data.tar.gz: e7a817e4d91766846da2274c4c0cb0b76fc116bb189c9d01f9bb5feb4555fe96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee9f89d51a6d0645887416dae70c6c435af1d87ed8d90a8c3f7c459ff2f3e6eb2776afe818cf1b1285ad323e3ca771a7d9e3b31ad91af1083789d1c3fcbc06d5
|
7
|
+
data.tar.gz: 1e3668e7158517017a779b1aac72abc85296c58c81c2388136b08b3228d2c5b045727282216af54daea838aed56474e4e639fb89ebf6e38ffeae02df70fe1698
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.7.0] - 2021-05-31
|
4
|
+
|
5
|
+
### Added
|
6
|
+
* Add :enable_color option to allow control over editor menu colouring
|
7
|
+
* Add :menu_interrupt to control how editor select menu handles interrupt signal
|
8
|
+
* Add gedit and kate to the list of default editors
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
* Change to search default editors when command and env variables checks fail
|
12
|
+
* Change to rename :show_menu option as :hide_menu to indicate default behaviour
|
13
|
+
* Change default editors list to be sorted in alphabetical order
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
* Fix Editor#exist? to correctly check command with an absolute path
|
17
|
+
|
3
18
|
## [v0.6.0] - 2020-09-22
|
4
19
|
|
5
20
|
### Added
|
@@ -84,6 +99,7 @@
|
|
84
99
|
|
85
100
|
* Initial implementation and release
|
86
101
|
|
102
|
+
[v0.7.0]: https://github.com/piotrmurach/tty-editor/compare/v0.6.0...v0.7.0
|
87
103
|
[v0.6.0]: https://github.com/piotrmurach/tty-editor/compare/v0.5.1...v0.6.0
|
88
104
|
[v0.5.1]: https://github.com/piotrmurach/tty-editor/compare/v0.5.0...v0.5.1
|
89
105
|
[v0.5.0]: https://github.com/piotrmurach/tty-editor/compare/v0.4.1...v0.5.0
|
@@ -94,4 +110,4 @@
|
|
94
110
|
[v0.2.0]: https://github.com/piotrmurach/tty-editor/compare/v0.1.2...v0.2.0
|
95
111
|
[v0.1.2]: https://github.com/piotrmurach/tty-editor/compare/v0.1.1...v0.1.2
|
96
112
|
[v0.1.1]: https://github.com/piotrmurach/tty-editor/compare/v0.1.0...v0.1.1
|
97
|
-
[v0.1.0]: https://github.com/piotrmurach/tty-editor/compare/v0.1.0
|
113
|
+
[v0.1.0]: https://github.com/piotrmurach/tty-editor/compare/762a7ec...v0.1.0
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2016 Piotr Murach
|
3
|
+
Copyright (c) 2016 Piotr Murach (piotrmurach.com)
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
<div align="center">
|
2
|
-
<a href="https://ttytoolkit.org"
|
2
|
+
<a href="https://ttytoolkit.org"><img width="130" src="https://github.com/piotrmurach/tty/raw/master/images/tty.png" alt="TTY Toolkit logo" /></a>
|
3
3
|
</div>
|
4
4
|
|
5
5
|
# TTY::Editor [![Gitter](https://badges.gitter.im/Join%20Chat.svg)][gitter]
|
6
6
|
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/tty-editor.svg)][gem]
|
8
|
-
[![
|
8
|
+
[![Actions CI](https://github.com/piotrmurach/tty-editor/workflows/CI/badge.svg?branch=master)][gh_actions_ci]
|
9
9
|
[![Build status](https://ci.appveyor.com/api/projects/status/yw4guy16meq5wkee?svg=true)][appveyor]
|
10
10
|
[![Maintainability](https://api.codeclimate.com/v1/badges/0afb9e75eef4ae4615c6/maintainability)][codeclimate]
|
11
11
|
[![Coverage Status](https://coveralls.io/repos/github/piotrmurach/tty-editor/badge.svg)][coverage]
|
12
|
-
[![Inline docs](
|
12
|
+
[![Inline docs](https://inch-ci.org/github/piotrmurach/tty-editor.svg?branch=master)][inchpages]
|
13
13
|
|
14
14
|
[gitter]: https://gitter.im/piotrmurach/tty
|
15
|
-
[gem]:
|
16
|
-
[
|
15
|
+
[gem]: https://badge.fury.io/rb/tty-editor
|
16
|
+
[gh_actions_ci]: https://github.com/piotrmurach/tty-editor/actions?query=workflow%3ACI
|
17
17
|
[appveyor]: https://ci.appveyor.com/project/piotrmurach/tty-editor
|
18
18
|
[codeclimate]:https://codeclimate.com/github/piotrmurach/tty-editor/maintainability
|
19
19
|
[coverage]: https://coveralls.io/github/piotrmurach/tty-editor
|
20
|
-
[inchpages]:
|
20
|
+
[inchpages]: https://inch-ci.org/github/piotrmurach/tty-editor
|
21
21
|
|
22
|
-
>
|
22
|
+
> Open a file or text in a preferred terminal text editor.
|
23
23
|
|
24
24
|
**TTY::Editor** provides independent component for [TTY](https://github.com/piotrmurach/tty) toolkit.
|
25
25
|
|
@@ -48,7 +48,11 @@ Or install it yourself as:
|
|
48
48
|
* [2.1.2 :env](#212-env)
|
49
49
|
* [2.1.3 :raise_on_failure](#213-raise_on_failure)
|
50
50
|
* [2.1.4 :prompt](#214-prompt)
|
51
|
+
* [2.1.5 :hide_menu](#215-hide_menu)
|
52
|
+
* [2.1.6 :enable_color](#216-enable_color)
|
53
|
+
* [2.1.7 :menu_interrupt](#217-menu_interrupt)
|
51
54
|
* [2.2 open](#22-open)
|
55
|
+
* [3. Default Editors](#3-default-editors)
|
52
56
|
|
53
57
|
## 1. Usage
|
54
58
|
|
@@ -80,17 +84,17 @@ TTY::Editor.open("/path/to/file", command: "vim -f")
|
|
80
84
|
|
81
85
|
When `VISUAL` or `EDITOR` are not specified, a selection menu will be presented to the user.
|
82
86
|
|
83
|
-
For example, if an user has `
|
87
|
+
For example, if an user has `code`, `emacs` and `vim` editors available on their system, they will see the following menu:
|
84
88
|
|
85
89
|
```
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
Select an editor?
|
91
|
+
1) code
|
92
|
+
2) emacs
|
93
|
+
3) vim
|
94
|
+
Choose 1-3 [1]:
|
91
95
|
```
|
92
96
|
|
93
|
-
You can further customise this behaviour with [:prompt](#214-prompt).
|
97
|
+
You can further customise this behaviour with [:prompt](#214-prompt), [:hide_menu](#215-hide_menu), [:enable_color](#216-enable_color) and [:menu_interrupt](#217-menu_interrupt).
|
94
98
|
|
95
99
|
## 2. API
|
96
100
|
|
@@ -160,14 +164,14 @@ editor.open("/path/to/unknown/file")
|
|
160
164
|
|
161
165
|
When more than one editor is available and user hasn't specified their preferred choice via `VISUAL` or `EDITOR` variables, a selection menu is presented.
|
162
166
|
|
163
|
-
For example, when `
|
167
|
+
For example, when `code`, `emacs` and `vim` executable exists on the system, the following menu will be displayed:
|
164
168
|
|
165
169
|
```
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
170
|
+
Select an editor?
|
171
|
+
1) code
|
172
|
+
2) emacs
|
173
|
+
3) vim
|
174
|
+
Choose 1-3 [1]:
|
171
175
|
```
|
172
176
|
|
173
177
|
If you would like to change the menu prompt use `:prompt` keyword:
|
@@ -180,11 +184,59 @@ editor.open("/path/to/file")
|
|
180
184
|
This may produce the following in the terminal:
|
181
185
|
|
182
186
|
```
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
187
|
+
Which one do you fancy?
|
188
|
+
1) code
|
189
|
+
2) emacs
|
190
|
+
3) vim
|
191
|
+
Choose 1-3 [1]:
|
192
|
+
```
|
193
|
+
|
194
|
+
#### 2.1.5 :hide_menu
|
195
|
+
|
196
|
+
When more than one editor is available from the default list, a selection menu will be displayed in the console:
|
197
|
+
|
198
|
+
```
|
199
|
+
Select an editor?
|
200
|
+
1) code
|
201
|
+
2) emacs
|
202
|
+
3) vim
|
203
|
+
Choose 1-3 [1]:
|
204
|
+
```
|
205
|
+
|
206
|
+
To hide the menu and automatically choose the first available editor use the `:hide_menu` keyword option:
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
editor = TTY::Editor.new(hide_menu: true)
|
210
|
+
```
|
211
|
+
|
212
|
+
#### 2.1.6 :enable_color
|
213
|
+
|
214
|
+
An editor selection menu will display the first choice in colour on terminals that support colours. However, you can turn off colouring with the `:enable_color` keyword option:
|
215
|
+
|
216
|
+
```ruby
|
217
|
+
editor = TTY::Editor.new(enable_color: false)
|
218
|
+
```
|
219
|
+
|
220
|
+
Equally, you can enforce the current menu choice to be always coloured:
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
editor = TTY::Editor.new(enable_color: true)
|
224
|
+
```
|
225
|
+
|
226
|
+
### 2.1.7 :menu_interrupt
|
227
|
+
|
228
|
+
When an editor selection menu gets interrupted by the `Ctrl+C` key, an `InputInterrupt` error is raised. To change this, provide the `:menu_interrupt` option with one of the following:
|
229
|
+
|
230
|
+
* `:error` - raises `InputInterrupt` error
|
231
|
+
* `:exit` - exits with `130` status code
|
232
|
+
* `:noop` - skips handler
|
233
|
+
* `:signal` - sends interrupt signal
|
234
|
+
* `proc` - custom proc handler
|
235
|
+
|
236
|
+
For example, to immediately exit the menu and program do:
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
editor = TTY::Editor.new(menu_interrupt: :exit)
|
188
240
|
```
|
189
241
|
|
190
242
|
### 2.2 open
|
@@ -241,6 +293,25 @@ You can also open multiple existing and non-existing files providing them as con
|
|
241
293
|
TTY::Editor.open("file_1", "file_2", "new_file_3")
|
242
294
|
```
|
243
295
|
|
296
|
+
## 3. Default Editors
|
297
|
+
|
298
|
+
When an editor in `EDITOR` and `VISUAL` environment variables can't be found or isn't specified, a choice menu is displayed. The menu includes available editors from the default list of text editors:
|
299
|
+
|
300
|
+
* `Atom`
|
301
|
+
* `Emacs`
|
302
|
+
* `gedit`
|
303
|
+
* `JED`
|
304
|
+
* `Kate`
|
305
|
+
* `Mg`
|
306
|
+
* `Nano`
|
307
|
+
* `Notepad`
|
308
|
+
* `Pico`
|
309
|
+
* `Sublime Text`
|
310
|
+
* `TextMate`
|
311
|
+
* `Vi`
|
312
|
+
* `Vim`
|
313
|
+
* `Visual Studio Code`
|
314
|
+
|
244
315
|
## Development
|
245
316
|
|
246
317
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -249,12 +320,16 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
249
320
|
|
250
321
|
## Contributing
|
251
322
|
|
252
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/piotrmurach/tty-editor. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [
|
323
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/piotrmurach/tty-editor. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/piotrmurach/tty-editor/blob/master/CODE_OF_CONDUCT.md).
|
253
324
|
|
254
325
|
## License
|
255
326
|
|
256
327
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
257
328
|
|
329
|
+
## Code of Conduct
|
330
|
+
|
331
|
+
Everyone interacting in the TTY::Editor project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/piotrmurach/tty-editor/blob/master/CODE_OF_CONDUCT.md).
|
332
|
+
|
258
333
|
## Copyright
|
259
334
|
|
260
335
|
Copyright (c) 2017 Piotr Murach. See LICENSE for further details.
|
data/lib/tty/editor.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "pathname"
|
4
4
|
require "shellwords"
|
5
5
|
require "tempfile"
|
6
6
|
require "tty-prompt"
|
@@ -25,13 +25,13 @@ module TTY
|
|
25
25
|
|
26
26
|
# List possible command line text editors
|
27
27
|
#
|
28
|
-
# @return [Array
|
28
|
+
# @return [Array<String>]
|
29
29
|
#
|
30
30
|
# @api public
|
31
31
|
EXECUTABLES = [
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
32
|
+
"atom", "code", "emacs", "gedit", "jed", "kate",
|
33
|
+
"mate -w", "mg", "nano -w", "notepad", "pico",
|
34
|
+
"qe", "subl -n -w", "vi", "vim"
|
35
35
|
].freeze
|
36
36
|
|
37
37
|
# Check if editor command exists
|
@@ -39,20 +39,35 @@ module TTY
|
|
39
39
|
# @example
|
40
40
|
# exist?("vim") # => true
|
41
41
|
#
|
42
|
+
# @example
|
43
|
+
# exist?("/usr/local/bin/vim") # => true
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# exist?("C:\\Program Files\\Vim\\vim.exe") # => true
|
47
|
+
#
|
48
|
+
# @param [String] command
|
49
|
+
# the command to check for the existence
|
50
|
+
#
|
42
51
|
# @return [Boolean]
|
43
52
|
#
|
44
53
|
# @api private
|
45
54
|
def self.exist?(command)
|
46
|
-
|
55
|
+
path = Pathname(command)
|
56
|
+
exts = [""].concat(ENV.fetch("PATHEXT", "").split(::File::PATH_SEPARATOR))
|
57
|
+
|
58
|
+
if path.absolute?
|
59
|
+
return exts.any? { |ext| ::File.exist?("#{command}#{ext}") }
|
60
|
+
end
|
61
|
+
|
47
62
|
ENV.fetch("PATH", "").split(::File::PATH_SEPARATOR).any? do |dir|
|
48
63
|
file = ::File.join(dir, command)
|
49
|
-
|
64
|
+
exts.any? { |ext| ::File.exist?("#{file}#{ext}") }
|
50
65
|
end
|
51
66
|
end
|
52
67
|
|
53
68
|
# Check editor from environment variables
|
54
69
|
#
|
55
|
-
# @return [Array
|
70
|
+
# @return [Array<String>]
|
56
71
|
#
|
57
72
|
# @api public
|
58
73
|
def self.from_env
|
@@ -61,24 +76,37 @@ module TTY
|
|
61
76
|
|
62
77
|
# Find available text editors
|
63
78
|
#
|
64
|
-
# @param [Array
|
79
|
+
# @param [Array<String>] commands
|
65
80
|
# the commands to use intstead of defaults
|
66
81
|
#
|
67
|
-
# @return [Array
|
82
|
+
# @return [Array<String>]
|
68
83
|
# the existing editor commands
|
69
84
|
#
|
70
85
|
# @api public
|
71
86
|
def self.available(*commands)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
87
|
+
if commands.any?
|
88
|
+
execs = search_executables(commands.map(&:to_s))
|
89
|
+
return execs unless execs.empty?
|
90
|
+
end
|
91
|
+
|
92
|
+
if from_env.any?
|
93
|
+
execs = search_executables(from_env)
|
94
|
+
return execs unless execs.empty?
|
95
|
+
end
|
96
|
+
|
97
|
+
search_executables(EXECUTABLES)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Search for existing executables
|
101
|
+
#
|
102
|
+
# @return [Array<String>]
|
103
|
+
#
|
104
|
+
# @api private
|
105
|
+
def self.search_executables(execs)
|
79
106
|
execs.compact.map(&:strip).reject(&:empty?).uniq
|
80
107
|
.select { |exec| exist?(exec.split.first) }
|
81
108
|
end
|
109
|
+
private_class_method :search_executables
|
82
110
|
|
83
111
|
# Open file in system editor
|
84
112
|
#
|
@@ -93,11 +121,11 @@ module TTY
|
|
93
121
|
#
|
94
122
|
# @param [Array<String>] files
|
95
123
|
# the files to open in an editor
|
96
|
-
# @param [String]
|
124
|
+
# @param [String] command
|
97
125
|
# the editor command to use, by default auto detects
|
98
|
-
# @param [String]
|
126
|
+
# @param [String] text
|
99
127
|
# the text to edit in an editor
|
100
|
-
# @param [Hash]
|
128
|
+
# @param [Hash] env
|
101
129
|
# environment variables to forward to the editor
|
102
130
|
#
|
103
131
|
# @return [Object]
|
@@ -110,30 +138,40 @@ module TTY
|
|
110
138
|
|
111
139
|
# Initialize an Editor
|
112
140
|
#
|
113
|
-
# @
|
141
|
+
# @example
|
142
|
+
# TTY::Editor.new(command: "vim")
|
143
|
+
#
|
144
|
+
# @param [String] command
|
114
145
|
# the editor command to use, by default auto detects
|
115
|
-
# @param [Hash]
|
146
|
+
# @param [Hash] env
|
116
147
|
# environment variables to forward to the editor
|
117
|
-
# @param [IO]
|
148
|
+
# @param [IO] input
|
118
149
|
# the standard input
|
119
|
-
# @param [IO]
|
150
|
+
# @param [IO] output
|
120
151
|
# the standard output
|
121
|
-
# @param [Boolean]
|
152
|
+
# @param [Boolean] raise_on_failure
|
122
153
|
# whether or not raise on command failure, false by default
|
123
|
-
# @param [Boolean]
|
124
|
-
# whether or not
|
154
|
+
# @param [Boolean] hide_menu
|
155
|
+
# whether or not to hide commands menu, false by default
|
156
|
+
# @param [Boolean] enable_color
|
157
|
+
# disable or force prompt coloring, defaults to nil
|
158
|
+
# @param [Symbol] menu_interrupt
|
159
|
+
# how to handle Ctrl+C key interrupt out of :error, :signal, :exit, :noop
|
125
160
|
#
|
126
161
|
# @api public
|
127
|
-
def initialize(command: nil, raise_on_failure: false,
|
128
|
-
prompt: "Select an editor?", env: {},
|
129
|
-
input: $stdin, output: $stdout,
|
162
|
+
def initialize(command: nil, raise_on_failure: false, hide_menu: false,
|
163
|
+
prompt: "Select an editor?", env: {}, enable_color: nil,
|
164
|
+
input: $stdin, output: $stdout, menu_interrupt: :error,
|
165
|
+
&block)
|
130
166
|
@env = env
|
131
167
|
@command = nil
|
132
168
|
@input = input
|
133
169
|
@output = output
|
134
170
|
@raise_on_failure = raise_on_failure
|
135
|
-
@
|
171
|
+
@enable_color = enable_color
|
172
|
+
@hide_menu = hide_menu
|
136
173
|
@prompt = prompt
|
174
|
+
@menu_interrupt = menu_interrupt
|
137
175
|
|
138
176
|
block.(self) if block
|
139
177
|
|
@@ -142,6 +180,12 @@ module TTY
|
|
142
180
|
|
143
181
|
# Read or update environment vars
|
144
182
|
#
|
183
|
+
# @example
|
184
|
+
# editor.env({"FOO" => "bar"})
|
185
|
+
#
|
186
|
+
# @param [Hash{String => String}] value
|
187
|
+
# the environment variables to use
|
188
|
+
#
|
145
189
|
# @return [Hash]
|
146
190
|
#
|
147
191
|
# @api public
|
@@ -151,12 +195,15 @@ module TTY
|
|
151
195
|
@env = value
|
152
196
|
end
|
153
197
|
|
154
|
-
# Finds command using a configured command(s) or detected shell commands
|
198
|
+
# Finds command using a configured command(s) or detected shell commands
|
199
|
+
#
|
200
|
+
# @example
|
201
|
+
# editor.command("vim")
|
155
202
|
#
|
156
|
-
# @param [Array
|
203
|
+
# @param [Array<String>] commands
|
157
204
|
# the optional command to use, by default auto detecting
|
158
205
|
#
|
159
|
-
# @raise [TTY::CommandInvocationError]
|
206
|
+
# @raise [TTY::Editor::CommandInvocationError]
|
160
207
|
#
|
161
208
|
# @return [String]
|
162
209
|
#
|
@@ -178,10 +225,10 @@ module TTY
|
|
178
225
|
#
|
179
226
|
# @param [Array<String>] files
|
180
227
|
# the files to open in an editor
|
181
|
-
# @param [String]
|
228
|
+
# @param [String] text
|
182
229
|
# the text to edit in an editor
|
183
230
|
#
|
184
|
-
# @raise [TTY::CommandInvocationError]
|
231
|
+
# @raise [TTY::Editor::CommandInvocationError]
|
185
232
|
#
|
186
233
|
# @return [Boolean]
|
187
234
|
# whether editor command suceeded or not
|
@@ -234,6 +281,8 @@ module TTY
|
|
234
281
|
#
|
235
282
|
# @raise [InvalidArgumentError]
|
236
283
|
#
|
284
|
+
# @return [nil]
|
285
|
+
#
|
237
286
|
# @api private
|
238
287
|
def validate_arguments(files, text)
|
239
288
|
return if files.empty?
|
@@ -269,8 +318,10 @@ module TTY
|
|
269
318
|
#
|
270
319
|
# @api private
|
271
320
|
def choose_exec_from(execs)
|
272
|
-
if
|
273
|
-
prompt = TTY::Prompt.new(input: @input, output: @output, env: @env
|
321
|
+
if !@hide_menu && execs.size > 1
|
322
|
+
prompt = TTY::Prompt.new(input: @input, output: @output, env: @env,
|
323
|
+
enable_color: @enable_color,
|
324
|
+
interrupt: @menu_interrupt)
|
274
325
|
exec = prompt.enum_select(@prompt, execs)
|
275
326
|
@output.print(prompt.cursor.up + prompt.cursor.clear_line)
|
276
327
|
exec
|
data/lib/tty/editor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-prompt
|
@@ -42,17 +42,17 @@ dependencies:
|
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description: Open a file or text in a terminal text editor.
|
55
|
+
description: Open a file or text in a preferred terminal text editor.
|
56
56
|
email:
|
57
57
|
- piotr@piotrmurach.com
|
58
58
|
executables: []
|
@@ -78,7 +78,7 @@ metadata:
|
|
78
78
|
documentation_uri: https://www.rubydoc.info/gems/tty-editor
|
79
79
|
homepage_uri: https://ttytoolkit.org
|
80
80
|
source_code_uri: https://github.com/piotrmurach/tty-editor
|
81
|
-
post_install_message:
|
81
|
+
post_install_message:
|
82
82
|
rdoc_options: []
|
83
83
|
require_paths:
|
84
84
|
- lib
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubygems_version: 3.1.2
|
97
|
-
signing_key:
|
97
|
+
signing_key:
|
98
98
|
specification_version: 4
|
99
|
-
summary: Open a file or text in a terminal text editor.
|
99
|
+
summary: Open a file or text in a preferred terminal text editor.
|
100
100
|
test_files: []
|