Crate oxur_cli

Crate oxur_cli 

Source
Expand description

Oxur CLI library and binary

This crate provides two things:

  1. Library: Common utilities for building Oxur CLI tools

    • File I/O helpers (stdin/stdout/file handling)
    • Colored terminal output (success, error, info, warnings)
    • Progress tracking for long-running operations
  2. Binary: The unified oxur command-line tool

§Library Usage

Add to your CLI’s Cargo.toml:

[dependencies]
oxur-cli = { path = "../oxur-cli" }

§Basic I/O

use oxur_cli::common::io::{read_input, write_output};
use std::path::PathBuf;

// Read from file or stdin
let content = read_input(&PathBuf::from("input.txt"))?;

// Write to file or stdout
write_output(&content, Some(&PathBuf::from("output.txt")))?;

§Colored Output

use oxur_cli::common::output::{success, error, info};

success("Operation completed!");
error("Something went wrong");
info("Processing files...");

§Progress Tracking

use oxur_cli::common::progress::ProgressTracker;

let mut progress = ProgressTracker::new(true);

progress.step("Loading data");
// ... do work ...
progress.done();

progress.step("Processing data");
// ... do work ...
progress.done();

progress.success("All done!");

Re-exports§

pub use common::progress::ProgressTracker;

Modules§

common
Common utilities for Oxur CLI tools
table
Styled table rendering for Oxur tools