-
Notifications
You must be signed in to change notification settings - Fork 0
/
cards
executable file
·66 lines (49 loc) · 1.31 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
#!/usr/bin/env ruby
require "pp"
require "yaml"
require "optparse"
require "stringio"
require "fileutils"
require "rubygems"
#require "backports"
require "colored"
require "ya2yaml"
#require "natural_sort_kernel"
#require "highline/system_extensions"
require "./lib/hash.rb"
require "./class.rb"
require "./cards_helper.rb"
require "./dir_mode.rb"
require "./file_mode.rb"
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
#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
ARGV[0].ex
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