Added manpages for fun and funstx and some small code changes. (0.39.3)
This commit is contained in:
parent
04951bee2a
commit
69b9b87dd4
5 changed files with 188 additions and 13 deletions
74
man/fun.1
Normal file
74
man/fun.1
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
.TH fun 1 "March 2026" "fun" "User Commands"
|
||||
.SH NAME
|
||||
fun \- Fun language runner and REPL
|
||||
.SH SYNOPSIS
|
||||
.B fun
|
||||
\fR[\fIoptions\fR] [\fIscript.fun\fR] [\fB--\fR \fIargs...\fR]
|
||||
.SH DESCRIPTION
|
||||
\fBfun\fR runs programs written for the Fun virtual machine. When invoked
|
||||
with a script path, it parses, compiles and executes the script. If no
|
||||
script is provided and the binary was built with REPL support, \fBfun\fR
|
||||
starts an interactive Read\-Eval\-Print Loop.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B -i , --repl
|
||||
Start the interactive REPL explicitly (if built with REPL support).
|
||||
.TP
|
||||
.B -v , --version
|
||||
Print version and exit.
|
||||
.TP
|
||||
.B -h , --help
|
||||
Show usage information and exit.
|
||||
.PP
|
||||
Note: Available options may vary by build configuration. Check
|
||||
\fBfun --help\fR for your binary.
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B FUN_LIB_DIR
|
||||
Top\-priority search path for included Fun modules. Set this when running
|
||||
from the source tree to point to \fI./lib\fR.
|
||||
.TP
|
||||
.B DEFAULT_LIB_DIR
|
||||
Compiled\-in default library directory searched after \fBFUN_LIB_DIR\fR.
|
||||
.SH EXIT STATUS
|
||||
.TP
|
||||
.B 0
|
||||
Success.
|
||||
.TP
|
||||
.B non\-zero
|
||||
Error during parse, compile, or runtime.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
Run an installed example:
|
||||
.nf
|
||||
fun /usr/share/fun/examples/hello.fun
|
||||
.fi
|
||||
.TP
|
||||
Run from a build tree without installing (point stdlib to repo):
|
||||
.nf
|
||||
FUN_LIB_DIR=./lib /path/to/build_dir/fun examples/hello.fun
|
||||
.fi
|
||||
.TP
|
||||
Pass arguments to a script (after -- they are forwarded):
|
||||
.nf
|
||||
fun myscript.fun -- arg1 arg2
|
||||
.fi
|
||||
.SH FILES
|
||||
.TP
|
||||
Binary (default install)
|
||||
\fI/usr/bin/fun\fR
|
||||
.TP
|
||||
Standard library (default install)
|
||||
\fI/usr/share/fun/lib\fR
|
||||
.TP
|
||||
Examples (optional, default install)
|
||||
\fI/usr/share/fun/examples\fR
|
||||
.SH SEE ALSO
|
||||
\fBfunstx\fR(1)
|
||||
.br
|
||||
Project documentation: \fIdocs/fun.md\fR, \fIdocs/cli.md\fR, \fIdocs/includes.md\fR
|
||||
.SH AUTHORS
|
||||
The Fun project authors.
|
||||
.SH COPYRIGHT
|
||||
\(co The Fun authors. Licensed under the project license; see the
|
||||
\fILICENSE\fR file distributed with this source.
|
||||
77
man/funstx.1
Normal file
77
man/funstx.1
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
.TH funstx 1 "March 2026" "fun" "User Commands"
|
||||
.SH NAME
|
||||
funstx \- Fun syntax checker and fixer
|
||||
.SH SYNOPSIS
|
||||
.B funstx
|
||||
\fR[\fB--fix\fR] \fIfile1.fun\fR [\fIfile2.fun\fR ...]
|
||||
.SH DESCRIPTION
|
||||
\fBfunstx\fR parses one or more \fI.fun\fR source files to verify syntax
|
||||
without executing them. With \fB--fix\fR, it attempts conservative,
|
||||
idempotent edits to align files with parser expectations and then
|
||||
re\-checks before writing changes.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B --fix
|
||||
Attempt safe automatic corrections before re\-checking. Only writes a file
|
||||
if the fixed version parses successfully.
|
||||
.SH OUTPUT
|
||||
.TP
|
||||
On success
|
||||
Prints "\fIpath/to/file.fun\fR: OK".
|
||||
.TP
|
||||
On failure
|
||||
Prints "\fIpath/to/file.fun\fR:line:col: syntax error: <message>".
|
||||
.SH EXIT STATUS
|
||||
.TP
|
||||
.B 0
|
||||
All provided files parsed successfully.
|
||||
.TP
|
||||
.B 1
|
||||
At least one file failed to parse (after optional fixing).
|
||||
.TP
|
||||
.B 2
|
||||
Incorrect usage (e.g., no files provided).
|
||||
.SH AUTO\-FIX RULES
|
||||
The fixer applies a small set of conservative transformations:
|
||||
.IP \(bu 2
|
||||
Normalize line endings: CRLF/CR \(-> LF.
|
||||
.IP \(bu 2
|
||||
Convert leading tabs to spaces; normalize indentation to multiples of two spaces.
|
||||
.IP \(bu 2
|
||||
Trim trailing spaces.
|
||||
.IP \(bu 2
|
||||
Ensure the file ends with a single newline.
|
||||
.IP \(bu 2
|
||||
Normalize type aliases: \fIsint8|sint16|sint32|sint64\fR \(-> \fIint8|int16|int32|int64\fR (word\-boundary aware).
|
||||
.PP
|
||||
Structural issues that require semantic changes are not auto\-fixed; if
|
||||
parsing still fails, the original file is left unchanged and an error is
|
||||
reported.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
Check a single file
|
||||
.nf
|
||||
funstx examples/arrays.fun
|
||||
.fi
|
||||
.TP
|
||||
Check and auto\-fix a file
|
||||
.nf
|
||||
funstx --fix examples/arrays.fun
|
||||
.fi
|
||||
.TP
|
||||
Bulk check and auto\-fix all examples
|
||||
.nf
|
||||
find examples -type f -name '*.fun' -print0 | xargs -0 -n 50 funstx --fix
|
||||
.fi
|
||||
.SH BUILD AND INSTALL
|
||||
Built as CMake target \fBfunstx\fR and installed alongside \fBfun\fR into
|
||||
\fI/usr/bin\fR by default.
|
||||
.SH SEE ALSO
|
||||
\fBfun\fR(1)
|
||||
.br
|
||||
Project documentation: \fIdocs/funstx.md\fR
|
||||
.SH AUTHORS
|
||||
The Fun project authors.
|
||||
.SH COPYRIGHT
|
||||
\(co The Fun authors. Licensed under the project license; see the
|
||||
\fILICENSE\fR file distributed with this source.
|
||||
Loading…
Add table
Add a link
Reference in a new issue