fs(3lua): init man pages
Initialise man pages for the fs module.
This commit is contained in:
parent
2c6ad19111
commit
5cd636d6a7
17 changed files with 561 additions and 0 deletions
36
man/fs/fs.entries.3lua.scd
Normal file
36
man/fs/fs.entries.3lua.scd
Normal file
|
@ -0,0 +1,36 @@
|
|||
FS.ENTRIES(3lua) "3lua" "Callisto manual pages"
|
||||
|
||||
# NAME
|
||||
*fs.entries* - iterate over a directory
|
||||
|
||||
# SYNOPSIS
|
||||
*fs.entries*([_directory_: *string*])
|
||||
|
||||
# DESCRIPTION
|
||||
*fs.entries* returns an iterator function which can be used to iterate
|
||||
over the contents of a directory, so that the idiom
|
||||
|
||||
for entry in fs.entries(_directory_)
|
||||
_code..._
|
||||
end
|
||||
|
||||
will run the code inside the loop for every directory entry.
|
||||
|
||||
Without any arguments *fs.entries* will iterate over the current
|
||||
working directory but an argument can be provided to use a different
|
||||
directory instead.
|
||||
|
||||
On each iteration, the iterator will return a table retrieved from
|
||||
fs.status(3lua), containing information about the next file in the
|
||||
directory such as its path, mode, owner, and modify date.
|
||||
|
||||
# EXAMPLES
|
||||
List every file and directory in _/etc_ and its type as retrieved from
|
||||
fs.type(3lua):
|
||||
|
||||
for entry in fs.entries("/etc") do
|
||||
print(fs.type("/etc/" .. entry.path), entry.path)
|
||||
end
|
||||
|
||||
# SEE ALSO
|
||||
callisto(3lua), fs(3lua), fs.status(3lua)
|
Loading…
Add table
Add a link
Reference in a new issue