prompting user for api key if config file does not exist

This commit is contained in:
Alan Hamlett 2013-07-10 19:47:42 -07:00
parent 4dd3b4b8d2
commit cbb5a9fa14
1 changed files with 9 additions and 0 deletions

View File

@ -45,6 +45,15 @@ let s:VERSION = '0.2.1'
if filereadable(expand("$HOME/.wakatime"))
exec "silent !mv" expand("$HOME/.wakatime") expand("$HOME/.wakatime.conf")
endif
" Create config file if does not exist
if !filereadable(expand("$HOME/.wakatime.conf"))
let key = input("Enter your WakaTi.me api key: ")
if key != ''
call writefile([printf("api_key=%s", key)], expand("$HOME/.wakatime.conf"))
echo "WakaTi.me setup complete! Visit https://wakati.me to view your logged time."
endif
endif
" Globals
let s:plugin_directory = expand("<sfile>:p:h") . '/'