lib/vimgolf/cli.rb in vimgolf-0.4.8 vs lib/vimgolf/cli.rb in vimgolf-0.4.9

- old
+ new

@@ -30,10 +30,19 @@ Thor::Base.shell = VimGolf::CLI::UI VimGolf.ui = VimGolf::CLI::UI.new super end + desc "version", "print version of Vimgolf client" + long_desc <<-DESC + Print version of the Vimgolf client. + DESC + + def version + VimGolf.ui.info "Client #{Vimgolf::VERSION}" + end + desc "setup", "configure your VimGolf credentials" long_desc <<-DESC To participate in the challenge please go to vimgolf.com and register an account. Once signed in, you will get your API key, which you need to setup the command client. @@ -107,15 +116,18 @@ # -i NONE - don't load .viminfo (for saved macros and the like) # +0 - always start on line 0 # -u vimrc - load vimgolf .vimrc to level the playing field # -U NONE - don't load .gvimrc # -W logfile - keylog file (overwrites if already exists) - vimcmd = GOLFVIM.shellsplit + %W{-Z -n --noplugin --nofork -i NONE +0 -u #{challenge.vimrc_path} -U NONE -W #{challenge.log_path} #{challenge.work_path}} + vimcmd = GOLFVIM.shellsplit + %W{-Z -n --noplugin -i NONE +0 -u #{challenge.vimrc_path} -U NONE -W #{challenge.log_path} #{challenge.work_path}} + if GOLFVIM == "gvim" + vimcmd += %W{ --nofork} + end debug(vimcmd) system(*vimcmd) # assembled as an array, bypasses the shell if $?.exitstatus.zero? - log = Keylog.new(IO.read(challenge.log_path)) + log = Keylog.new(IO.binread(challenge.log_path)) VimGolf.ui.info "\nHere are your keystrokes:" VimGolf.ui.print_log log # Handle incorrect solutions