55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/super_stamper/cli.rb', line 55
def self.execute(stdout, arguments=[])
options = {
:filename => 'header.txt',
:extension => 'rb',
:quote => false
}
mandatory_options = %w( )
parser = OptionParser.new do |opts|
opts.banner = " Easily add a header (such as a copyright notice or license) recursively to multiple files in your project directory.\n\n Usage: \#{File.basename($0)} [options]\n\n Options are:\n BANNER\n opts.separator \"\"\n ########################################################################\n opts.on(\"-e\", \"--extension PATH\", String,\n \"Which extension to look for.\",\n \"Default: rb\") { |arg| options[:extension] = arg }\n ########################################################################\n opts.on(\"-f\", \"--filename PATH\", String,\n \"Which file to use as header.\",\n \"Default: header.txt\") { |arg| options[:filename] = arg }\n ########################################################################\n opts.on(\"-q\", \"--[no-]quote\", \"Adds a random quote from the Bash.org QDB. Uses your Internet connection to obtain the quotes from the QDB RSS feed.\") do |q|\n options[:quote] = q\n end\n ########################################################################\n opts.on(\"-h\", \"--help\",\n \"Show this help message.\") { stdout.puts opts; exit }\n ########################################################################\n opts.on(\"-v\", \"--version\", \"Print version (\#{SuperStamper::VERSION})\") { stdout.puts \"\#{SuperStamper::VERSION}\"; exit }\n opts.parse!(arguments)\n\n if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }\n stdout.puts opts; exit\n end\n end\n\n filename = options[:filename]\n extension = options[:extension]\n quote = options[:quote]\n\n SuperStamper::Base.stamp_recursively(:header_file_name => filename, :extension => extension, :quote => quote)\nend\n".gsub(/^ /, '')
|