mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-15 01:44:19 +00:00
Last commit before tagging and releasing
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: optp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: option_parse { .. }
|
||||
# --
|
||||
require "optparse"
|
||||
|
||||
options = {${1::default => "args"}}
|
||||
|
||||
ARGV.options do |opts|
|
||||
opts.banner = "Usage: #{File.basename(\$PROGRAM_NAME)} [OPTIONS]${2/^\s*$|(.*\S.*)/(?1: )/}${2:OTHER_ARGS}"
|
||||
|
||||
opts.separator ""
|
||||
opts.separator "Specific Options:"
|
||||
|
||||
$0
|
||||
|
||||
opts.separator "Common Options:"
|
||||
|
||||
opts.on( "-h", "--help",
|
||||
"Show this message." ) do
|
||||
puts opts
|
||||
exit
|
||||
end
|
||||
|
||||
begin
|
||||
opts.parse!
|
||||
rescue
|
||||
puts opts
|
||||
exit
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user