-
Notifications
You must be signed in to change notification settings - Fork 0
/
cards
executable file
·77 lines (59 loc) · 1.53 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
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/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"
require "./lib/hash.rb"
require "./class.rb"
require "./cards_helper.rb"
require "./dir_mode.rb"
require "./file_mode.rb"
require "fileutils"
require "./lib/def.rb"
require "./lib/bind.rb"
require "./lib/flash.rb"
require "./lib/statistic.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
$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
opts.on( '-w', '--without-clear', "Disable clear function" ) do |f|
def clear; end
end
end.parse!
def home_dir
if have_args?
ARGV[0].ex
else
rc("default_dir").ex
end
end
def main
trap("INT") do
exit
end
FileUtils.mkdir_p home_dir unless File.exists? home_dir
goto_dir_mode home_dir
end
main