pipelight/utils
2024-01-17 11:51:33 +01:00
..
public set watchexec ignore filter 2023-10-01 20:18:53 +02:00
src add early config read for early error return 2024-01-10 14:02:00 +01:00
Cargo.toml add lib global recursive error type 2023-10-27 18:31:01 +02:00
README.md cleaner definitions 2024-01-17 11:51:33 +01:00

Utils crate

What is inside ?

Convenience functions

  • Teleport
  • Git
  • Logger
  • Date

Logger

The logger is built on top of log4rs. Its on its way to be deprecated because it provides not ernough flexibility.

Only use to log internals to stdout

Git

Contains functions to:

  • detect the git directory
  • create and ensure pipelight git hooks

Logger

Contains functions to:

  • create and ensure a logger

Teleport

This utility is greatly inspired by cosmiconfig. Teleport::search("filename") seeks a file based on globbing pattern you provided.

Contains functions to:

  • Recursively search a file through the filesystem
  • Change process cwd back and forth from the pwd and the file parent directory.

let mut portal = Teleport::new().preffix("pipelight");
portal.search()?;

// Teleport process to file path
portal.teleport();
// Teleport process to where it was originaly launched
portal.origin();

Dates

Abstraction over date convertion and duration computation.

Files

Abstraction over file reading, filepath (std::path::Path) usage...