magus v0.3.0 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
1 min read

path

Pure path-string math: abs, rel, clean, is_abs, expand_user.

Naming convention: import the module under its bare name (import "path"), reach members with a backslash, and call methods in camelCase: path\someMethod.

Methods

abs

Return the absolute form of path, resolved against the current directory and lexically cleaned.

Signature: path\abs(path) → string · source

Parameter Type Optional Description
path string

Returns: string

rel

Return a relative path from base to target; errors if no relative path exists.

Signature: path\rel(base, target) → string · source

Parameter Type Optional Description
base string
target string

Returns: string

clean

Return the shortest lexically-equivalent path (resolves . and .., collapses separators).

Signature: path\clean(path) → string · source

Parameter Type Optional Description
path string

Returns: string

isAbs

Report whether path is absolute.

Signature: path\isAbs(path) → bool · source

Parameter Type Optional Description
path string

Returns: bool

expandUser

Expand a leading ~ (or ~/...) to the current user's home directory; other paths are returned unchanged.

Signature: path\expandUser(path) → string · source

Parameter Type Optional Description
path string

Returns: string

auto-generatedpathmodulestdlibmagusfile
Last updated (e0463131)
Earlier changes on this page (1)

Full history ↗ · Blame source ↗

Glossary

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. See targets.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. See targets.

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. See the module reference.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.