-
Notifications
You must be signed in to change notification settings - Fork 3
/
dataknife.rb
executable file
·43 lines (39 loc) · 1.19 KB
/
dataknife.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env ruby
#
# Inception: I keep running into data, and it frustrates me to deal with it.
# There are lots of things I want to do with data, and there are too many
# separate tools for it. Ruby can accomplish almost all of my purposes...
# perhaps I can make a data-swiss-army-knife.
#
# Author: Josh Stone
# Contact: [email protected]
# Date: 2014-07-02
#
#
require 'rubygems'
module Dataknife
load File.dirname(File.realdirpath(__FILE__))+"/modules.rb"
Plugins.init
if ARGV.length == 0
puts
puts "------------------------------------------------------------------------"
puts " Data Knife - by Josh Stone ([email protected]) - (C) 2014"
puts "------------------------------------------------------------------------"
puts
puts "usage: #{$0} <cmd>"
puts
puts " Most plugins read from standard input and print the result"
puts " on the standard output stream."
puts
Plugins.plugins.sort {|i,j| i.command <=> j.command}.each do |plugin|
printf " %-20s %s\n", plugin.syntax, plugin.help
end
puts
exit 1
end
Plugins.plugins.each do |plugin|
if ARGV[0] == plugin.command
plugin.main(ARGV[1..-1])
end
end
end