Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
fix: use non-deprecated checkhealth methods
Browse files Browse the repository at this point in the history
Use non-deprecated checkhealth syntax
  • Loading branch information
stevearc committed Jan 4, 2024
2 parents 4378648 + bc107a6 commit a5d61c7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions autoload/health/gkeep.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,63 @@

function! health#gkeep#check()
call gkeep#preload()
call health#report_start('gkeep')
call v:lua.vim.health.start('gkeep')
if !has('python3')
call health#report_error('Python provider error:', ["gkeep requires python3", "Run :checkhealth provider for more info"])
call v:lua.vim.health.error('Python provider error:', ["gkeep requires python3", "Run :checkhealth provider for more info"])
return
endif

python3 import sys
let exe = py3eval('sys.executable')
let [ok, error] = provider#pythonx#CheckForModule(exe, 'gkeepapi', 3)
if !ok
call health#report_error(error)
call v:lua.vim.health.error(error)
else
python3 import gkeepapi
let l:version = py3eval('gkeepapi.__version__')
call health#report_ok("gkeepapi " . l:version . " installed")
call v:lua.vim.health.ok("gkeepapi " . l:version . " installed")
python3 import gpsoauth
let l:version = py3eval('gpsoauth.__version__')
call health#report_ok("gpsoauth " . l:version . " installed")
call v:lua.vim.health.ok("gpsoauth " . l:version . " installed")
python3 import urllib3
let l:version = py3eval('urllib3.__version__')
call health#report_ok("urllib3 " . l:version . " installed")
call v:lua.vim.health.ok("urllib3 " . l:version . " installed")
endif
let [ok, error] = provider#pythonx#CheckForModule(exe, 'keyring', 3)
if !ok
call health#report_error(error)
call v:lua.vim.health.error(error)
else
call health#report_ok("keyring installed")
call v:lua.vim.health.ok("keyring installed")
endif

if exists(':GkeepLogin') != 2
call health#report_error('Remote plugin not found', 'Try running :UpdateRemotePlugins and restart')
call v:lua.vim.health.error('Remote plugin not found', 'Try running :UpdateRemotePlugins and restart')
return
endif

let health = _gkeep_health()

if health.logged_in
call health#report_ok('Logged in as ' . health.email)
call v:lua.vim.health.ok('Logged in as ' . health.email)
elseif health.has_token
call health#report_warn('Not logged in but auth token exists', 'Try :GkeepOpen')
call v:lua.vim.health.warn('Not logged in but auth token exists', 'Try :GkeepOpen')
else
call health#report_warn('Not logged in', 'Try :GkeepLogin')
call v:lua.vim.health.warn('Not logged in', 'Try :GkeepLogin')
endif

if !empty(health.sync_dir)
call health#report_info("Syncing notes to " . health.sync_dir)
call v:lua.vim.health.info("Syncing notes to " . health.sync_dir)
endif
if health.support_neorg
call health#report_ok("Neorg support enabled")
call v:lua.vim.health.ok("Neorg support enabled")
endif
if !empty(health.keyring_err)
call health#report_error("Error with keyring provider: " . health.keyring_err, 'See https://github.com/stevearc/gkeep.nvim/issues/8')
call v:lua.vim.health.error("Error with keyring provider: " . health.keyring_err, 'See https://github.com/stevearc/gkeep.nvim/issues/8')
endif

let status = GkeepStatus()
if !empty(status)
call health#report_info(status)
call v:lua.vim.health.info(status)
endif
call health#report_info("Log file: " . stdpath('cache') . '/gkeep.log')
call v:lua.vim.health.info("Log file: " . stdpath('cache') . '/gkeep.log')
endfunction

0 comments on commit a5d61c7

Please sign in to comment.