which_command 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme +21 -0
- data/bin/whereis +39 -0
- data/bin/which +51 -0
- metadata +70 -0
data/Readme
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
= __
|
2
|
+
|
3
|
+
[<b>Home page</b>:] http://__.rubyforge.org/
|
4
|
+
[<b>Project site</b>:] http://rubyforge.org/projects/__
|
5
|
+
[<b>Gem install</b>:] <tt>gem install __</tt>
|
6
|
+
[<b>Wiki</b>:] http://wiki.qualitysmith.com/__
|
7
|
+
[<b>Author</b>:] __
|
8
|
+
[<b>Copyright</b>:] 2007 QualitySmith, Inc.
|
9
|
+
[<b>License</b>:] {GNU General Public License}[http://www.gnu.org/copyleft/gpl.html]
|
10
|
+
|
11
|
+
== Introduction
|
12
|
+
|
13
|
+
...
|
14
|
+
|
15
|
+
== Installation
|
16
|
+
|
17
|
+
...
|
18
|
+
|
19
|
+
== Usage
|
20
|
+
|
21
|
+
...
|
data/bin/whereis
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pp'
|
3
|
+
require 'rubygems'
|
4
|
+
gem 'facets'
|
5
|
+
require 'facets/core/fileutils/whereis'
|
6
|
+
gem 'quality_extensions'
|
7
|
+
require 'quality_extensions/console/command'
|
8
|
+
|
9
|
+
class WhereIsCommand < Console::Command
|
10
|
+
def __help
|
11
|
+
@help = true
|
12
|
+
end
|
13
|
+
|
14
|
+
def main(*files)
|
15
|
+
if @help
|
16
|
+
puts <<End
|
17
|
+
Usage: whereis program_name [...]
|
18
|
+
Options:
|
19
|
+
--help, Print this help and exit successfully.
|
20
|
+
End
|
21
|
+
return
|
22
|
+
end
|
23
|
+
|
24
|
+
files.each do |file|
|
25
|
+
print "#{file}: "
|
26
|
+
if whereis = FileUtils.whereis(file)
|
27
|
+
puts whereis.join(' ')
|
28
|
+
else
|
29
|
+
puts
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
if ARGV.size < 1
|
36
|
+
WhereIsCommand.start('--help')
|
37
|
+
else
|
38
|
+
WhereIsCommand.start
|
39
|
+
end
|
data/bin/which
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pp'
|
3
|
+
require 'rubygems'
|
4
|
+
gem 'facets'
|
5
|
+
require 'facets/core/fileutils/which'
|
6
|
+
gem 'quality_extensions'
|
7
|
+
require 'quality_extensions/console/command'
|
8
|
+
|
9
|
+
class WhichCommand < Console::Command
|
10
|
+
def __help
|
11
|
+
@help = true
|
12
|
+
end
|
13
|
+
|
14
|
+
def main(*files)
|
15
|
+
if @help
|
16
|
+
puts <<End
|
17
|
+
Usage: which [options] program_name [...]
|
18
|
+
Options:
|
19
|
+
--help, Print this help and exit successfully.
|
20
|
+
Not implemented:
|
21
|
+
--version, -[vV] Print version and exit successfully.
|
22
|
+
--skip-dot Skip directories in PATH that start with a dot.
|
23
|
+
--skip-tilde Skip directories in PATH that start with a tilde.
|
24
|
+
--show-dot Don't expand a dot to current directory in output.
|
25
|
+
--show-tilde Output a tilde for HOME directory for non-root.
|
26
|
+
--tty-only Stop processing options on the right if not on tty.
|
27
|
+
--all, -a Print all matches in PATH, not just the first
|
28
|
+
--read-alias, -i Read list of aliases from stdin.
|
29
|
+
--skip-alias Ignore option --read-alias; don't read stdin.
|
30
|
+
--read-functions Read shell functions from stdin.
|
31
|
+
--skip-functions Ignore option --read-functions; don't read stdin.
|
32
|
+
End
|
33
|
+
return
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
files.each do |file|
|
38
|
+
if which = FileUtils.which(file)
|
39
|
+
puts which
|
40
|
+
else
|
41
|
+
puts "No #{file} in #{ENV['PATH']}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
if ARGV.size < 1
|
48
|
+
WhichCommand.start('--help')
|
49
|
+
else
|
50
|
+
WhichCommand.start
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.2
|
3
|
+
specification_version: 1
|
4
|
+
name: which_command
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.0.2
|
7
|
+
date: 2007-07-18 00:00:00 -07:00
|
8
|
+
summary: ...
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email:
|
12
|
+
homepage: http://quality-ext.rubyforge.org
|
13
|
+
rubyforge_project: which_command
|
14
|
+
description: ...
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- ...
|
31
|
+
files:
|
32
|
+
- bin/whereis
|
33
|
+
- bin/which
|
34
|
+
- Readme
|
35
|
+
test_files: []
|
36
|
+
|
37
|
+
rdoc_options:
|
38
|
+
- --title
|
39
|
+
- which_command
|
40
|
+
- --main
|
41
|
+
- Readme
|
42
|
+
- --line-numbers
|
43
|
+
extra_rdoc_files:
|
44
|
+
- Readme
|
45
|
+
executables:
|
46
|
+
- which
|
47
|
+
- whereis
|
48
|
+
extensions: []
|
49
|
+
|
50
|
+
requirements: []
|
51
|
+
|
52
|
+
dependencies:
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: facets
|
55
|
+
version_requirement:
|
56
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.0.0
|
61
|
+
version:
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: quality_extensions
|
64
|
+
version_requirement:
|
65
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.0.0
|
70
|
+
version:
|