#cli/core

    Shared MoonBit libraries for command parsing, byte streams, filesystem access, HTTP transport and command-language execution. The procfs package reads Linux kernel fields for system queries. The terminal package reads compiled ncurses directory entries and classifies POSIX standard descriptors redirected to files, pipes or sockets.

    #Usage

    The checksum command adapter selects the default untagged record marker for the host and hashes the original input bytes.

    Declare a released cli/core dependency in your module and import the packages you need. For example, import cli/core/cli as cli:

    let options = [@cli.flag("verbose", short='v'), @cli.option("output", short='o')]
    let args = @cli.parse(["-v", "-o", "result.txt", "input.txt"], options[:])
    assert_eq(args.last_value("output"), Some("result.txt"))
    assert_eq(args.operands, ["input.txt"])

    For standard async I/O, use stream.ChunkReader for bounded reads and the from_binary constructors on RecordReader, LineScanner and BlockWriter. Record views retain their bytes across subsequent reads. The checksum and gzip codecs accept standard binary readers and writers.

    #Packages

    PackagePurpose
    cliOption parsing and structured argument errors.
    stream, tempioBounded binary reads, record scanning, buffered output and temporary-file I/O.
    fsops, fswalk, platformPath/filesystem mechanisms, traversal and host capabilities.
    pathresolvePhysical and lexical canonicalization with explicit component-existence policies.
    bytesearch, bytereByte searching and the C-byte and C.UTF-8 grep regex engines.
    archivefsBounded regular-file and directory collection and extraction for tar and ZIP.
    textwidthIncremental UTF-8 decoding, scalar cell widths and horizontal blanks for C.UTF-8.
    numfmt, quotingNumeric parsing/formatting and byte/path quoting.
    checksum, checksum/cliDigest algorithms and shared checksum command handling.
    gzipops, gzipops/cliGzip streams and shared codec command handling.
    netopsHTTP transport over standard async TCP and TLS, URL, IDNA and public-suffix mechanisms.
    time_zoneTimezone selection, TZif/POSIX conversion and local-time validation.
    process, shellStandard async child processes, redirection and the supported shell language.

    The generated pkg.generated.mbti in each package lists its current public API. Command-specific argument policy, diagnostics and effects remain in the owning command; there is no executable moonx cli/core entry.

    #Notes

    Build from source with the MoonBit 1.0 RC1 toolchain.

    • Product consumers target MoonX/Wasm and use released public MoonBit APIs. Host permissions and unavailable filesystem/process metadata remain explicit limits; these libraries do not delegate command implementations to host tools.
    • Packages support Wasm only, except platform and gzipops, which also support Native for the test runner and benchmark-tool regressions.
    • Internal package APIs can differ between releases. Use the interface for your selected dependency; command compatibility does not imply a stable internal source API.
    • For current command support, see the compatibility guide. Release history belongs in CHANGELOG, and algorithm details in docs/performance.

    Archive extraction requires a caller-controlled destination tree. Another process must not rename or replace a parent between the directory check and file creation. A filesystem error can leave earlier extracted files in place.