exe/githelp in githelp-0.3.1 vs exe/githelp in githelp-0.3.2

- old
+ new

@@ -51,11 +51,25 @@ } puts "-----------------GitHelpデータを検出" @pagedata.each { |title,pagedata| puts "...#{title}" processing_defs = false + codeindent = nil pagedata.each { |line| + if !codeindent + if line =~ /^(\s*)code:/ + codeindent = $1.length + next + end + else + line =~ /^(\s*)/ + if line.length < codeindent + codeindent = nil + else + next + end + end if line =~ /^\s*[\$\%]/ puts line if line =~ /^\%/ && !processing_defs puts "'$'で始まる用例定義なしでコマンドを定義しようとしています" exit @@ -122,11 +136,15 @@ } io.close_write io.gets } if res - cmd = res.sub(/^\s*/,'') + if res =~ /^\#\[(\d+)\]/ + cmd = list[$1.to_i][1] + else + cmd = res.sub(/^\s*/,'') + end puts cmd system cmd end else res = IO.popen(pager, "w") {|io| @@ -136,9 +154,15 @@ } } end end +end + +is_repository = system 'git rev-parse --git-dir > /dev/null >& /dev/null' +unless is_repository + STDERR.puts "Gitレポジトリで実行して下さい" + exit end options = ARGV.getopts('ut') githelp = GitHelp.new