-
Notifications
You must be signed in to change notification settings - Fork 0
/
cards
executable file
·64 lines (50 loc) · 1.2 KB
/
cards
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env ruby
require 'rbconfig'
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
puts "Segmentation fault"
exit
end
require "pp"
require "yaml"
require "optparse"
require "stringio"
@@options = {:config => "~/.cardsrc"}
OptionParser.new do |opts|
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
opts.on( '-c', '--config FILE', "Config file" ) do |f|
@@options[:config] = f
end
end.parse!
require "lib/hash.rb"
require "cards_helper.rb"
require "dir_mode.rb"
require "file_mode.rb"
require "fileutils.rb"
require "lib/def.rb"
require "lib/bind.rb"
Dir.glob(File.dirname(__FILE__) + '/commands/*', &method(:require))
user_commands_file = File.expand_path "~/.bu_commands.rb"
require user_commands_file if File.exist? user_commands_file
require "rubygems"
require "backports"
require "colored"
$KCODE = 'UTF8'
require "ya2yaml"
require "natural_sort_kernel"
require "highline/system_extensions"
include HighLine::SystemExtensions
def main
trap("INT") do
exit
end
dir = if have_args?
ARGV[0].ex
else
rc("default_dir").ex
end
goto_dir_mode dir
end
main