Skip to content

File system methods for the Gleam file globbing library `globlin`

License

Notifications You must be signed in to change notification settings

apainintheneck/globlin_fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

globlin_fs

Package Version Hex Docs

This package adds onto the functionality in the globlin package by adding file system globbing. The main reason to keep it separate is to not require simplifile in the original globlin package so it can be used in the browser.

Note: This library only currently supports Unix file paths. That means it should work on Linux, macOS and BSD.

Add Dependency

gleam add globlin_fs

Example

 import gleam/io
 import gleam/list
 import gleam/string
 import globlin
 import globlin_fs

 pub fn main() {
   let assert Ok(pattern) = globlin.new_pattern("**/*.gleam")
   case globlin_fs.glob(pattern, returning: globlin_fs.RegularFiles) {
     Ok(files) -> {
       files
       |> list.sort(string.compare)
       |> list.each(io.println)
     }
     Error(err) -> {
       io.print("File error: ")
       io.debug(err)
       Nil
     }
   }
 }

Further documentation can be found at https://hexdocs.pm/globlin_fs.

Development

gleam test  # Run the tests

About

File system methods for the Gleam file globbing library `globlin`

Topics

Resources

License

Stars

Watchers

Forks

Languages