πŸ“¦ justjavac / moonbit-glob

A glob library for MoonBit, supporting wildcard pattern matching on file paths.

β˜… 2 stars β‘‚ 3 forks πŸ‘ 2 watching βš–οΈ MIT License
globmoonbitpathpattern
πŸ“₯ Clone https://github.com/justjavac/moonbit-glob.git
HTTPS git clone https://github.com/justjavac/moonbit-glob.git
SSH git clone git@github.com:justjavac/moonbit-glob.git
CLI gh repo clone justjavac/moonbit-glob
θΏ·ζΈ‘ θΏ·ζΈ‘ fix: remove redundant moon test --doc steps from CI workflow 29d775e 8 days ago πŸ“ History
πŸ“‚ main View all commits β†’
πŸ“ .github
πŸ“ src
πŸ“„ .gitignore
πŸ“„ LICENSE
πŸ“„ moon.mod.json
πŸ“„ README.md
πŸ“„ README.md

Glob

A glob pattern matching library for MoonBit, supporting wildcard pattern matching on file paths and strings.

Features

  • Basic Wildcards: Support for * (matches any characters) and ? (matches
single character)
  • Directory Traversal: Support for ** (matches across directory
boundaries)
  • Path-Aware Matching: Single * respects directory boundaries, **
crosses them
  • Character Classes: Basic validation for bracket expressions [abc]
(validation only)
  • Escaping: Utility to escape special characters for literal matching
  • Bulk Operations: Functions to match against multiple paths or patterns

Installation

moon update
moon add justjavac/glob

Usage

// Match text files
let result = glob("*.txt", "readme.txt")
assert_eq(result, true)

// Single character wildcard
let result = glob("file?.log", "file1.log")
assert_eq(result, true)

// Cross-directory matching
let result = glob("**/*.mbt", "src/main.mbt")
assert_eq(result, true)

Pattern Syntax

PatternDescriptionExampleMatchesDoesn't Match
*Matches any characters (except path separators)*.txtfile.txt, readme.txtdir/file.txt
**Matches any characters (including path separators)**/*.txtdir/file.txt, a/b/c.txtfile.py
?Matches exactly one characterfile?.txtfile1.txt, fileA.txtfile.txt, file12.txt
[abc]Character class (validation only)file[123].txtvalidated syntax onlynot implemented
LiteralMatches exact charactersreadme.txtreadme.txtREADME.txt

License

This project is licensed under the MIT License.