---@meta no_os_execute

--------------------------------------------------------------------------------
-- no_os_execute file and process auxiliary module
--------------------------------------------------------------------------------

---@alias no_os_execute_error_list string[]

---@class no_os_execute*
---@field _VERSION string module version
---@type no_os_execute*
local M = {}

M._VERSION = "0.4.3"

--- Recursively modify the permissions of a file or directory.
---
--- `dmode` uses the chmod mode value written in decimal, such as `644`, `755`, `4755`.
---@param path string File or directory path
---@param dmode integer Permission mode, range 0 ~ 7777
function M.lchmod_r(path, dmode) end

--- Recursively modify the owner of a file or directory.
---@param path string File or directory path
---@param uid integer User ID
---@param gid integer User group ID
function M.lchown_r(path, uid, gid) end

--- Recursively modify the owner and permissions of a file or directory.
---
--- `dmode` uses the chmod mode value written in decimal, such as `644`, `755`, `4755`.
---@param path string File or directory path
---@param uid integer User ID
---@param gid integer User group ID
---@param dmode integer Permission mode, range 0 ~ 7777
function M.lchownmod_r(path, uid, gid, dmode) end

--- Recursively clear the contents of one or more directories, preserving the directories themselves.
---@param ... string directory path
---@return no_os_execute_error_list errlist Delete failed error message list; empty list when successful
function M.clear_dirs(...) end

--- Recursively delete one or more files or directories.
---@param ... string File or directory path
---@return no_os_execute_error_list errlist Delete failed error message list; empty list when successful
function M.rm_rf(...) end

--- Copy files or directories recursively.
---
--- Shell wildcards are not supported, and file names are not escaped according to shell rules.
---@param src string Source file or directory path
---@param dest string Target file or directory path
---@return no_os_execute_error_list errlist List of error messages when copying fails; empty list when successful
function M.cp_r(src, dest) end

--- Create one or more directories recursively.
---@param ... string directory path
function M.mkdir_p(...) end

--- Sends a signal to all matching processes by process name.
---@param sig integer signal value
---@param ... string process name
function M.killall(sig, ...) end

--- Clear cache and restart SpringBoard/backboardd.
function M.respring() end

--- Execute the command via `/bin/sh -c`.
---@param command string command text
---@return boolean? ok Whether to exit successfully
---@return string? reason End reason or error message
---@return integer? status status code or errno
function M.system(command) end

--- Start the program and wait for it to end.
---
--- This is an alias for `spawn.run`. Arguments are not expanded by the shell.
---@param program string Program path or command name
---@param ... string parameters
---@return boolean? ok Whether to exit successfully
---@return string? reason End reason or error message
---@return integer? status status code or errno
function M.run_cmd(program, ...) end

return M
