Skip to content

Commit

Permalink
show scores on failed attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
igrigorik committed Jan 4, 2011
1 parent 0538c68 commit 08a04e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/vimgolf/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ def put(id = nil)

if $?.exitstatus.zero?
diff = `#{GOLFDIFF} \"#{input(id, type)}\" \"#{output(id)}\"`
score = Keylog.score(IO.read(log(id)))

if diff.size > 0
VimGolf.ui.warn "Uh oh, looks like your entry does not match the desired output:"
VimGolf.ui.warn "#"*50
puts diff
VimGolf.ui.warn "#"*50
VimGolf.ui.warn "Please try again!"
VimGolf.ui.warn "Please try again! Your score for this (failed) attempt was: #{score}"
return
end

score = Keylog.score(IO.read(log(id)))
VimGolf.ui.info "Success! Your output matches. Your score: #{score}"

if VimGolf.ui.yes? "Upload result to VimGolf? (yes / no)"
Expand Down

0 comments on commit 08a04e3

Please sign in to comment.