mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add --limit option and default it to 20
This commit is contained in:
parent
1e9057b54a
commit
d180e40570
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,7 @@ def self.output=(output)
|
||||||
@output = output
|
@output = output
|
||||||
end
|
end
|
||||||
@suppress_not_found = false
|
@suppress_not_found = false
|
||||||
|
@limit = 20
|
||||||
|
|
||||||
format = '%Y-%m-%dT%H:%M:%S%z'
|
format = '%Y-%m-%dT%H:%M:%S%z'
|
||||||
srcdir = nil
|
srcdir = nil
|
||||||
|
@ -39,6 +40,9 @@ parser = OptionParser.new {|opts|
|
||||||
self.output = :modified
|
self.output = :modified
|
||||||
format = fmt if fmt
|
format = fmt if fmt
|
||||||
end
|
end
|
||||||
|
opts.on("--limit=NUM", "limit branch name length (#@limit)", Integer) do |n|
|
||||||
|
@limit = n
|
||||||
|
end
|
||||||
opts.on("-q", "--suppress_not_found") do
|
opts.on("-q", "--suppress_not_found") do
|
||||||
@suppress_not_found = true
|
@suppress_not_found = true
|
||||||
end
|
end
|
||||||
|
@ -60,7 +64,7 @@ vcs = nil
|
||||||
("#define RUBY_FULL_REVISION #{last.inspect}" unless short == last),
|
("#define RUBY_FULL_REVISION #{last.inspect}" unless short == last),
|
||||||
if branch
|
if branch
|
||||||
e = '..'
|
e = '..'
|
||||||
limit = 16
|
limit = @limit
|
||||||
name = branch.sub(/\A(.{#{limit-e.size}}).{#{e.size+1},}/o) {$1+e}
|
name = branch.sub(/\A(.{#{limit-e.size}}).{#{e.size+1},}/o) {$1+e}
|
||||||
"#define RUBY_BRANCH_NAME #{name.dump}"
|
"#define RUBY_BRANCH_NAME #{name.dump}"
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue