1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! # cmdx - Cross-Platform Command and Path Translator Library
//!
//! A high-performance library for translating shell commands and file paths between
//! different operating systems. Designed for integration into terminal emulators
//! and cross-platform tools.
//!
//! ## Features
//!
//! - **Command Translation**: Translate shell commands with flag support
//! - **Path Translation**: Bidirectional file path translation (Windows ↔ Unix)
//! - **OS Detection**: Runtime detection of the current operating system
//! - **High Performance**: Static lookup tables with lazy initialization
//!
//! ## Command Translation Example
//!
//! ```
//! use cmdx::{translate_command, Os};
//!
//! // Translate a Windows command to Linux
//! let result = translate_command("dir /w", Os::Windows, Os::Linux);
//! assert!(result.is_ok());
//! assert!(result.unwrap().command.contains("ls"));
//!
//! // Translate a Linux command to Windows
//! let result = translate_command("ls -la", Os::Linux, Os::Windows);
//! assert!(result.is_ok());
//! assert!(result.unwrap().command.contains("dir"));
//! ```
//!
//! ## Path Translation Example
//!
//! ```
//! use cmdx::{translate_path, Os};
//!
//! // Windows to Linux path
//! let result = translate_path("C:\\Users\\john\\file.txt", Os::Windows, Os::Linux);
//! assert!(result.is_ok());
//! assert_eq!(result.unwrap().path, "/mnt/c/Users/john/file.txt");
//!
//! // Linux to Windows path
//! let result = translate_path("/mnt/c/Users/john", Os::Linux, Os::Windows);
//! assert!(result.is_ok());
//! assert_eq!(result.unwrap().path, "C:\\Users\\john");
//! ```
//!
//! ## Terminal Emulator Integration
//!
//! ```
//! use cmdx::{translate_command, translate_path, detect_os, Os};
//!
//! // Detect the current OS at runtime
//! let current_os = detect_os();
//!
//! // Translate user input for a different target OS
//! fn process_input(input: &str, target_os: Os) -> String {
//! let current = cmdx::detect_os();
//!
//! // Try command translation first
//! if let Ok(result) = cmdx::translate_command(input, current, target_os) {
//! return result.command;
//! }
//!
//! // Fall back to path translation if it looks like a path
//! if let Ok(result) = cmdx::translate_path(input, current, target_os) {
//! return result.path;
//! }
//!
//! input.to_string()
//! }
//! ```
// Command translation exports
pub use ;
pub use ;
// Path translation exports
pub use ;
// Environment variable translation exports
pub use ;
// OS detection exports
pub use ;