@@ -14,21 +14,21 @@ M.__name = "fold"
1414M .errors = {
1515
1616 --- @param section Section ?
17- --- @return string
17+ --- @return string errmsg
1818 unterminated_section = function (section )
1919 return " Unterminated section: " .. (tostring (section ) or " nil" )
2020 end ,
2121
2222 --- @param line number
23- --- @return string
23+ --- @return string errmsg
2424 inconsistent_indent = function (line )
2525 return " Inconsistent indent on line " .. line
2626 end ,
2727
2828 --- @param retry_count number
2929 --- @param section Section ?
3030 --- @param is_local boolean ?
31- --- @return string
31+ --- @return string errmsg
3232 maximum_retry_count = function (retry_count , section , is_local )
3333 return " Maximum "
3434 .. (is_local and " local " or " " )
@@ -39,7 +39,7 @@ M.errors = {
3939 end ,
4040
4141 --- @param path Path
42- --- @return string
42+ --- @return string errmsg
4343 path_should_not_be_directory = function (path )
4444 return " `config.resolve_path` returned directory-type Path ("
4545 .. path :escaped ()
@@ -48,14 +48,14 @@ M.errors = {
4848
4949 --- @param path string
5050 --- @param section Section ?
51- --- @return string
51+ --- @return string errmsg
5252 cannot_write = function (path , section )
5353 return " Cannot write to path " .. path .. " \n " .. tostring (section )
5454 end ,
5555
5656 --- @param command string
5757 --- @param err string ?
58- --- @return string
58+ --- @return string errmsg
5959 command_failed = function (command , err )
6060 return " Failed to execute command: "
6161 .. command
@@ -64,14 +64,15 @@ M.errors = {
6464 end ,
6565
6666 --- @param path string
67- --- @return string
67+ --- @return string errmsg
6868 expected_file_to_be_writable = function (path )
6969 return " Expected file " .. tostring (path ) .. " to be writable"
7070 end ,
7171}
7272
7373--- @param ctx Context
74- --- @return Section ?, string ?
74+ --- @return Section ? section
75+ --- @return string ? errmsg
7576M .parse = function (ctx )
7677 local curr_section , err = Section :new (
7778 0 ,
160161
161162--- @param section_root Section
162163--- @param ctx Context
163- --- @return nil , string ?
164+ --- @return nil
165+ --- @return string ? errmsg
164166M .prepare = function (section_root , ctx )
165167 --- @type { [string] : Section }
166168 local created_files = {}
265267--- @param section_root Section
266268--- @param ctx Context
267269--- @param is_dry_run boolean ?
268- --- @return Plan ?, string ?
270+ --- @return Plan ? plan
271+ --- @return string ? errmsg
269272M .execute = function (section_root , ctx , is_dry_run )
270273 is_dry_run = is_dry_run or false
271274 local io = ctx .io
@@ -308,7 +311,7 @@ M.execute = function(section_root, ctx, is_dry_run)
308311 --- @param lines string[]
309312 --- @param path Path
310313 --- @param is_overwrite boolean ?
311- --- @return string ?
314+ --- @return string ? errmsg
312315 local function write (handle , lines , path , is_overwrite )
313316 is_overwrite = is_overwrite or false
314317 created_or_modified_paths [tostring (path )] = 1
@@ -325,7 +328,7 @@ M.execute = function(section_root, ctx, is_dry_run)
325328 end
326329
327330 --- @param directory Path
328- --- @return string ?
331+ --- @return string ? errmsg
329332 local function mkdir (directory )
330333 created_or_modified_paths [tostring (directory )] = 1
331334 if not is_dry_run then
0 commit comments