1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 09:47:17 +00:00

Tweak os docs

This commit is contained in:
sogaiu 2021-01-14 08:44:56 +09:00
parent 9b42d5a5e9
commit 122e2a9378

View File

@ -1887,27 +1887,27 @@ static const JanetReg os_cfuns[] = {
"os/which", os_which, "os/which", os_which,
JDOC("(os/which)\n\n" JDOC("(os/which)\n\n"
"Check the current operating system. Returns one of:\n\n" "Check the current operating system. Returns one of:\n\n"
"\t:windows\n" "* :windows\n\n"
"\t:macos\n" "* :macos\n\n"
"\t:web - Web assembly (emscripten)\n" "* :web - Web assembly (emscripten)\n\n"
"\t:linux\n" "* :linux\n\n"
"\t:freebsd\n" "* :freebsd\n\n"
"\t:openbsd\n" "* :openbsd\n\n"
"\t:netbsd\n" "* :netbsd\n\n"
"\t:posix - A POSIX compatible system (default)\n\n" "* :posix - A POSIX compatible system (default)\n\n"
"May also return a custom keyword specified at build time.") "May also return a custom keyword specified at build time.")
}, },
{ {
"os/arch", os_arch, "os/arch", os_arch,
JDOC("(os/arch)\n\n" JDOC("(os/arch)\n\n"
"Check the ISA that janet was compiled for. Returns one of:\n\n" "Check the ISA that janet was compiled for. Returns one of:\n\n"
"\t:x86\n" "* :x86\n\n"
"\t:x86-64\n" "* :x86-64\n\n"
"\t:arm\n" "* :arm\n\n"
"\t:aarch64\n" "* :aarch64\n\n"
"\t:sparc\n" "* :sparc\n\n"
"\t:wasm\n" "* :wasm\n\n"
"\t:unknown\n") "* :unknown\n")
}, },
#ifndef JANET_REDUCED_OS #ifndef JANET_REDUCED_OS
{ {
@ -1929,22 +1929,22 @@ static const JanetReg os_cfuns[] = {
{ {
"os/stat", os_stat, "os/stat", os_stat,
JDOC("(os/stat path &opt tab|key)\n\n" JDOC("(os/stat path &opt tab|key)\n\n"
"Gets information about a file or directory. Returns a table If the third argument is a keyword, returns " "Gets information about a file or directory. Returns a table if the second argument is a keyword, returns "
" only that information from stat. If the file or directory does not exist, returns nil. The keys are\n\n" " only that information from stat. If the file or directory does not exist, returns nil. The keys are:\n\n"
"\t:dev - the device that the file is on\n" "* :dev - the device that the file is on\n\n"
"\t:mode - the type of file, one of :file, :directory, :block, :character, :fifo, :socket, :link, or :other\n" "* :mode - the type of file, one of :file, :directory, :block, :character, :fifo, :socket, :link, or :other\n\n"
"\t:int-permissions - A Unix permission integer like 8r744\n" "* :int-permissions - A Unix permission integer like 8r744\n\n"
"\t:permissions - A Unix permission string like \"rwxr--r--\"\n" "* :permissions - A Unix permission string like \"rwxr--r--\"\n\n"
"\t:uid - File uid\n" "* :uid - File uid\n\n"
"\t:gid - File gid\n" "* :gid - File gid\n\n"
"\t:nlink - number of links to file\n" "* :nlink - number of links to file\n\n"
"\t:rdev - Real device of file. 0 on windows.\n" "* :rdev - Real device of file. 0 on windows.\n\n"
"\t:size - size of file in bytes\n" "* :size - size of file in bytes\n\n"
"\t:blocks - number of blocks in file. 0 on windows\n" "* :blocks - number of blocks in file. 0 on windows\n\n"
"\t:blocksize - size of blocks in file. 0 on windows\n" "* :blocksize - size of blocks in file. 0 on windows\n\n"
"\t:accessed - timestamp when file last accessed\n" "* :accessed - timestamp when file last accessed\n\n"
"\t:changed - timestamp when file last changed (permissions changed)\n" "* :changed - timestamp when file last changed (permissions changed)\n\n"
"\t:modified - timestamp when file last modified (content changed)\n") "* :modified - timestamp when file last modified (content changed)\n")
}, },
{ {
"os/lstat", os_lstat, "os/lstat", os_lstat,
@ -2018,20 +2018,20 @@ static const JanetReg os_cfuns[] = {
{ {
"os/execute", os_execute, "os/execute", os_execute,
JDOC("(os/execute args &opts flags env)\n\n" JDOC("(os/execute args &opts flags env)\n\n"
"Execute a program on the system and pass it string arguments. Flags " "Execute a program on the system and pass it string arguments. `flags` "
"is a keyword that modifies how the program will execute.\n\n" "is a keyword that modifies how the program will execute.\n\n"
"\t:e - enables passing an environment to the program. Without :e, the " "* :e - enables passing an environment to the program. Without :e, the "
"current environment is inherited.\n" "current environment is inherited.\n\n"
"\t:p - allows searching the current PATH for the binary to execute. " "* :p - allows searching the current PATH for the binary to execute. "
"Without this flag, binaries must use absolute paths.\n" "Without this flag, binaries must use absolute paths.\n\n"
"\t:x - raise error if exit code is non-zero.\n" "* :x - raise error if exit code is non-zero.\n\n"
"env is a table or struct mapping environment variables to values. It can also " "`env` is a table or struct mapping environment variables to values. It can also "
"contain the keys :in, :out, and :err, which allow redirecting stdio in the subprocess. " "contain the keys :in, :out, and :err, which allow redirecting stdio in the subprocess. "
"These arguments should be core/file values. " "These arguments should be core/file values. "
"One can also pass in the :pipe keyword " "One can also pass in the :pipe keyword "
"for these arguments to create files that will read (for :err and :out) or write (for :in) " "for these arguments to create files that will read (for :err and :out) or write (for :in) "
"to the file descriptor of the subprocess. This is only useful in os/spawn, which takes " "to the file descriptor of the subprocess. This is only useful in `os/spawn`, which takes "
"the same parameters as os/execute, but will return an object that contains references to these " "the same parameters as `os/execute`, but will return an object that contains references to these "
"files via (return-value :in), (return-value :out), and (return-value :err). " "files via (return-value :in), (return-value :out), and (return-value :err). "
"Returns the exit status of the program.") "Returns the exit status of the program.")
}, },
@ -2105,19 +2105,19 @@ static const JanetReg os_cfuns[] = {
{ {
"os/date", os_date, "os/date", os_date,
JDOC("(os/date &opt time local)\n\n" JDOC("(os/date &opt time local)\n\n"
"Returns the given time as a date struct, or the current time if no time is given. " "Returns the given time as a date struct, or the current time if `time` is not given. "
"Returns a struct with following key values. Note that all numbers are 0-indexed. " "Returns a struct with following key values. Note that all numbers are 0-indexed. "
"Date is given in UTC unless local is truthy, in which case the date is formatted for " "Date is given in UTC unless `local` is truthy, in which case the date is formatted for "
"the local timezone.\n\n" "the local timezone.\n\n"
"\t:seconds - number of seconds [0-61]\n" "* :seconds - number of seconds [0-61]\n\n"
"\t:minutes - number of minutes [0-59]\n" "* :minutes - number of minutes [0-59]\n\n"
"\t:hours - number of hours [0-23]\n" "* :hours - number of hours [0-23]\n\n"
"\t:month-day - day of month [0-30]\n" "* :month-day - day of month [0-30]\n\n"
"\t:month - month of year [0, 11]\n" "* :month - month of year [0, 11]\n\n"
"\t:year - years since year 0 (e.g. 2019)\n" "* :year - years since year 0 (e.g. 2019)\n\n"
"\t:week-day - day of the week [0-6]\n" "* :week-day - day of the week [0-6]\n\n"
"\t:year-day - day of the year [0-365]\n" "* :year-day - day of the year [0-365]\n\n"
"\t:dst - If Day Light Savings is in effect") "* :dst - if Day Light Savings is in effect")
}, },
{ {
"os/rename", os_rename, "os/rename", os_rename,