Skip to content

jeremyjung/mruby-tty-which

 
 

Repository files navigation

TTY::Which Gitter

Gem Version Build Status Build status Code Climate Coverage Status Inline docs

Platform independent implementation of Unix which utility that searches for executable file in the path variable.

TTY::Which provides cross-platform executables search component for TTY toolkit.

Installation

Add this line to your application's Gemfile:

gem 'tty-which'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tty-which

Usage

TTY::Which has which method that searches the path for executable file.

When the path to executable exists, an absolute path is returned, otherwise nil.

For example, to find location for a single executable do:

TTY::Which.which('less')  # => '/usr/bin/less'
TTY::Which.which('git')   # => 'C:\Program Files\Git\bin\git'

You can also check an absolute path to executable:

TTY::Which.which('/usr/bin/ruby')  # => '/usr/bin/ruby'

The exist? returns true if the executable exists in the path and false otherwise:

TTY::Which.exist?('ruby') # => true

Contributing

  1. Fork it ( https://github.com/piotrmurach/tty-which/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Copyright

Copyright (c) 2015-2017 Piotr Murach. See LICENSE for further details.

About

Cross-platform implementation of Unix `which` command

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%