vx_shim/lib.rs
1//! VX Shim - Cross-platform executable shim for vx tool manager
2//!
3//! This crate provides a lightweight, cross-platform executable that acts as a proxy
4//! to other executables, similar to scoop-better-shimexe but written in Rust for
5//! better cross-platform support and modern features.
6//!
7//! ## Features
8//!
9//! - **Cross-Platform**: Works on Windows, macOS, and Linux
10//! - **Fast Execution**: Minimal overhead with efficient process management
11//! - **Signal Handling**: Proper Ctrl+C and signal forwarding to child processes
12//! - **Process Management**: Automatic cleanup of child processes
13//! - **Flexible Configuration**: Support for both TOML and legacy Scoop formats
14//! - **Environment Variables**: Support for custom environment variables
15//! - **Working Directory**: Configurable working directory for target executables
16//!
17//! ## Usage
18//!
19//! ### As a Library
20//!
21//! ```rust,no_run
22//! use vx_shim::{ShimConfig, Executor};
23//!
24//! # fn main() -> anyhow::Result<()> {
25//! // Load configuration
26//! let config = ShimConfig::parse(r#"
27//! path = "/bin/echo"
28//! args = "hello"
29//! "#)?;
30//!
31//! // Execute with arguments
32//! let executor = Executor::new(config);
33//! let exit_code = executor.execute(&["world".to_string()])?;
34//! # Ok(())
35//! # }
36//! ```
37//!
38//! ### Shim Management
39//!
40//! ```rust
41//! use vx_shim::ShimManager;
42//! use tempfile::TempDir;
43//!
44//! # fn main() -> anyhow::Result<()> {
45//! let temp_dir = TempDir::new()?;
46//! let manager = ShimManager::new(temp_dir.path());
47//!
48//! // Create a shim
49//! let shim_path = manager.create_shim("git", "/usr/bin/git", Some("status"))?;
50//!
51//! // List shims
52//! let shims = manager.list_shims()?;
53//!
54//! // Remove shim
55//! manager.remove_shim("git")?;
56//! # Ok(())
57//! # }
58//! ```
59
60pub mod config;
61pub mod executor;
62pub mod platform;
63pub mod shim;
64
65// Re-export main types for convenience
66pub use config::ShimConfig;
67pub use executor::Executor;
68pub use shim::ShimManager;