File tree Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ local defaults = {
1717 use_absolute_path = false , --- @type boolean
1818 relative_to_current_file = false , --- @type boolean
1919
20+ -- show warning messages
21+ verbose = true , --- @type boolean | fun (): boolean
22+
2023 -- template options
2124 template = " $FILE_PATH" , --- @type string
2225 url_encode_path = false , --- @type boolean
Original file line number Diff line number Diff line change @@ -57,17 +57,15 @@ M.has = function(feature)
5757end
5858
5959--- @param msg string
60- --- @param verbose boolean ?
61- M .warn = function (msg , verbose )
62- if M .verbose or verbose then
60+ M .warn = function (msg )
61+ if config .get_opt (" verbose" ) then
6362 vim .notify (msg , vim .log .levels .WARN , { title = " img-clip" })
6463 end
6564end
6665
6766--- @param msg string
68- --- @param verbose boolean ?
69- M .error = function (msg , verbose )
70- if M .verbose or verbose then
67+ M .error = function (msg )
68+ if config .get_opt (" verbose" ) then
7169 vim .notify (msg , vim .log .levels .ERROR , { title = " img-clip" })
7270 end
7371end
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ describe("config", function()
1313 assert .equals (" assets" , config .get_opt (" dir_path" ))
1414 assert .equals (" %Y-%m-%d-%H-%M-%S" , config .get_opt (" file_name" ))
1515 assert .equals (" png" , config .get_opt (" extension" ))
16+ assert .is_true (config .get_opt (" verbose" ))
1617 assert .is_false (config .get_opt (" url_encode_path" ))
1718 assert .is_false (config .get_opt (" use_absolute_path" ))
1819 assert .is_false (config .get_opt (" relative_to_current_file" ))
Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ The plugin is highly configurable. Please refer to the default configuration bel
9292 use_absolute_path = false , --- @type boolean | fun (): boolean
9393 relative_to_current_file = false , --- @type boolean | fun (): boolean
9494
95+ -- logging options
96+ verbose = true , --- @type boolean | fun (): boolean
97+
9598 -- template options
9699 template = " $FILE_PATH" , --- @type string | fun ( context : table ): string
97100 url_encode_path = false , --- @type boolean | fun (): boolean
You can’t perform that action at this time.
0 commit comments