find.cr v2.0.0

SplayTreeMap CI GitHub release GitHub commits since latest release (by SemVer)

find.cr

This shard is inspired by the Ruby module:

https://ruby-doc.org/stdlib-2.7.2/libdoc/find/rdoc/index.html

It implements a simple API for the top down traversal of a set of paths, and it provides a convenience method for a simple-to-use matching system that depends on Crystal's file matching syntax.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      find:
        github: wyhaines/find.cr
    

Usage

require "find"

The API is simple.

require 'find'

total_size = 0

Find.find(ENV["HOME"]) do |path|
  if File.directory?(path)
    if File.basename(path).start_with?('.')
      Find.prune       # Don't look any further into this directory.
    else
      next
    end
  end

  total_size += FileTest.size(path)
end

GitHub code size in bytes GitHub issues

Repository

find.cr

Owner
Statistic
  • 3
  • 1
  • 1
  • 1
  • 1
  • almost 2 years ago
  • March 1, 2021
License

Apache License 2.0

Links
Synced at

Tue, 23 Apr 2024 20:49:21 GMT

Languages