SkillAgentSearch skills...

Pathlib

Gleam library for working with unix paths

Install / Use

/learn @delucks/Pathlib
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

pathlib

pathlib is a Gleam library for working with filesystem paths on Unix systems. Analogous modules are Elixir's Path or Python's os.path.

Usage

let test_path = "/opt/installation/bin/client"

// Test if the path is rooted
pathlib.is_absolute(test_path) // -> True
pathlib.is_relative(test_path) // -> False

// Remove root and trailing slash
pathlib.trim_separator(test_path) // -> "opt/installation/bin/client"

// basename & dirname
pathlib.basename(test_path) // -> "client"
pathlib.dirname(test_path)  // -> "/opt/installation/bin"

// split & join
pathlib.split(test_path)           // -> ["opt", "installation", "bin", "client"]
pathlib.join(["usr", "bin", "ls"]) // -> "/usr/bin/ls"

Quick start

# Build the project
rebar3 compile

# Run the eunit tests
rebar3 eunit

# Run the Erlang REPL
rebar3 shell

Installation

If available in Hex this package can be installed by adding pathlib to your rebar.config dependencies:

{deps, [
    pathlib
]}.
View on GitHub
GitHub Stars6
CategoryDevelopment
Updated3y ago
Forks0

Languages

Erlang

Security Score

70/100

Audited on Jan 19, 2023

No findings