README.md in tty-editor-0.4.1 vs README.md in tty-editor-0.5.0
- old
+ new
@@ -57,11 +57,11 @@
```ruby
TTY::Editor.open('hello.rb', command: :vim)
```
-Also, the `VISUAL` or `EDITOR` shell environment variables take precedencee when auto detecting available editors.
+Also, the `VISUAL` or `EDITOR` shell environment variables take precedence when auto detecting available editors.
## Interface
### open
@@ -69,10 +69,16 @@
```ruby
TTY::Editor.open
```
+To open a file at a path pass it as a first argument:
+
+```ruby
+TTY::Editor.open('../README.md')
+```
+
When editor successfully opens file or content then `true` is returned.
If the editor cannot be opened, a `TTY::Editor::CommandInvocation` error is raised.
In order to open text content inside an editor do:
@@ -103,10 +109,18 @@
```ruby
TTY::Editor.open('hello.rb', command: :vim)
```
+To specify more than one command, and hence give a user a choice do:
+
+```ruby
+TTY::Editor.open('hello.rb') do |editor|
+ editor.command :vim, :emacs
+end
+```
+
## Development
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.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -119,6 +133,6 @@
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
## Copyright
-Copyright (c) 2017-2018 Piotr Murach. See LICENSE for further details.
+Copyright (c) 2017 Piotr Murach. See LICENSE for further details.