@@ -152,13 +152,12 @@ function AsyncDownloadManager:new(opts)
152152 self .max_threads = tonumber (opts .max_threads ) > 0 and tonumber (opts .max_threads ) or 5
153153 local stat , _ = uv .fs_stat (self .path )
154154 if stat and stat .type ~= " directory" then
155- utils .warn (string.format (
156- [[ "%s" already exists and is not a directory (type:%s)]] , self .path , stat .type ))
155+ utils .error ([[ "%s" already exists and is not a directory (type:%s)]] , self .path , stat .type )
157156 return
158157 end
159158 if not stat then
160159 if vim .fn .mkdir (self .path , " p" ) ~= 1 then
161- utils .warn ( string.format ( [[ Unable to create cache directory "%s"]] , self .path ) )
160+ utils .error ( [[ Unable to create cache directory "%s"]] , self .path )
162161 return
163162 end
164163 end
@@ -192,11 +191,11 @@ function AsyncDownloadManager:load_db(db)
192191 self .db = db
193192 for k , p in pairs (self .db or {}) do
194193 if type (p .url ) ~= " string" then
195- utils .warn (string.format ( " package %s: missing 'url'" , k ) )
194+ utils .warn (" package %s: missing 'url'" , k )
196195 return false
197196 end
198197 if type (p .colorschemes ) ~= " table" or utils .tbl_isempty (p .colorschemes ) then
199- utils .warn (string.format ( " package %s: missing or empty 'colorschemes'" , k ) )
198+ utils .warn (" package %s: missing or empty 'colorschemes'" , k )
200199 return false
201200 end
202201 local github_url = " https://github.com/"
@@ -215,8 +214,7 @@ function AsyncDownloadManager:load_db(db)
215214 for i , v in ipairs (p .colorschemes ) do
216215 p .colorschemes [i ].disp_name = v .disp_name or p .disp_name
217216 if not v .name and not v .lua and not v .vim then
218- utils .warn (string.format (
219- " package %s: colorschemes[%d], must contain at least 'name|lua|vim'" , k , i ))
217+ utils .warn (" package %s: colorschemes[%d], must contain at least 'name|lua|vim'" , k , i )
220218 return false
221219 end
222220 end
@@ -298,7 +296,7 @@ function AsyncDownloadManager:jobstart(plugin, job_args)
298296 job_args [2 ] = vim .tbl_extend (" keep" , job_args [2 ] or {},
299297 {
300298 on_exit = function (_ , rc , _ )
301- utils .info (string.format ( " %s [job_id:%d] finished with exit code %s" , plugin , job_id , rc ) )
299+ utils .info (" %s [job_id:%d] finished with exit code %s" , plugin , job_id , rc )
302300 if type (info .on_exit ) == " function" then
303301 -- this calls `coroutine.resume` and resumes fzf's reload input stream
304302 info .on_exit (_ , rc , _ )
@@ -313,11 +311,10 @@ function AsyncDownloadManager:jobstart(plugin, job_args)
313311 if job_id == 0 then
314312 utils .warn (" jobstart: invalid args" )
315313 elseif job_id == - 1 then
316- utils .warn (string.format ( [[ jobstart: "%s" is not executable]] , job_args [1 ]) )
314+ utils .warn ([[ jobstart: "%s" is not executable]] , job_args [1 ])
317315 else
318316 -- job started successfully
319- utils .info (string.format (" %s [path:%s] [job_id:%d]..." ,
320- msg , path .HOME_to_tilde (assert (info .path )), job_id ))
317+ utils .info (" %s [path:%s] [job_id:%d]..." , msg , path .HOME_to_tilde (assert (info .path )), job_id )
321318 self .job_ids [tostring (job_id )] = { plugin = plugin , args = job_args }
322319 self .db [plugin ].job_id = job_id
323320 end
@@ -352,7 +349,7 @@ M.apply_awesome_theme = function(dbkey, idx, opts)
352349 -- TODO: should we check `package.loaded[...]` before packadd?
353350 local ok , out = pcall (function () vim .cmd (" packadd " .. p .dir ) end )
354351 if not ok then
355- utils .warn ( string.format ( " Unable to packadd %s: %s" , p .dir , tostring (out ) ))
352+ utils .error ( " Unable to packadd %s: %s" , p .dir , tostring (out ))
356353 return
357354 end
358355 if cs .vim then
@@ -363,7 +360,7 @@ M.apply_awesome_theme = function(dbkey, idx, opts)
363360 ok , out = pcall (function () vim .cmd (" colorscheme " .. cs .name ) end )
364361 end
365362 if not ok then
366- utils .warn ( string.format ( " Unable to apply colorscheme %s: %s" , cs .disp_name , tostring (out ) ))
363+ utils .error ( " Unable to apply colorscheme %s: %s" , cs .disp_name , tostring (out ))
367364 end
368365end
369366
@@ -382,13 +379,13 @@ M.awesome_colorschemes = function(opts)
382379
383380 local json_string = utils .read_file (dbfile )
384381 if not json_string or # json_string == 0 then
385- utils .warn ( string.format ( " Unable to load json db (%s)" , opts .dbfile ) )
382+ utils .error ( " Unable to load json db (%s)" , opts .dbfile )
386383 return
387384 end
388385
389386 local ok , json_db = pcall (vim .json .decode , json_string )
390387 if not ok then
391- utils .warn (string.format (" Json decode failed: %s" , json_db ))
388+ utils .error (string.format (" Json decode failed: %s" , json_db ))
392389 return
393390 end
394391
0 commit comments