STV Path Converter 🌐
A smart and versatile command-line tool that supports flexible conversion between Windows and Linux path formats, offering style customization and advanced formatting options.
Key Features ✨
- Automatic Direction Detection: Intelligently identifies input path format (Windows ↔ Linux).
- Multi-Style Support: Compatible with WSL, Cygwin, and POSIX path standards.
- Environment Variable Handling: Optionally expands or preserves environment variables (
%VAR%↔$VAR). - Custom Mount Prefix: Define personalized mount points (e.g.,
/my-mount/). - Format Control:
- Quote handling policy (
always/auto/never) - Trailing slash management
- Case conversion (force lowercase/uppercase)
- Quote handling policy (
- Path Validation: Checks for illegal characters in Windows paths.
- Batch Processing: Supports reading paths from files or standard input.
Installation Guide 📦
Install via pip
pip install stv_path_converter
Build from Source
- Clone the repository:
git clone https://github.com/StarWindv/win-linux-path_converter
- Install using Poetry:
cd win-linux-path_converter pip install .
Usage Examples 🛠️
Basic Conversion
stv_path "C:\Program Files"
# Output: /mnt/c/Program\ Files
stv_path "/my_mount/c/user/docs" -m my_mount
# Output: C:\home\user\docs
Quick Reference for Advanced Options
| Option | Description |
|---|---|
-d, --direction |
Conversion direction: auto (default), win-to-linux, linux-to-win |
-s, --style |
Conversion style: wsl, cygwin, posix (default: wsl) |
-m, --mount-prefix |
Custom mount prefix (e.g., /my-mount/) |
-q, --quote |
Quote handling policy (auto/always/never) |
-t, --trailing-slash |
Trailing slash handling (keep/always/never) |
--lower/--upper |
Force lowercase/uppercase output |
-e, --expand-env |
Expand environment variables |
--validate |
Validate Windows path legality |
Scenario Examples
-
Convert Windows UNC path to WSL format:
stv_path "\\server\share\file.txt" --style wsl # Output: /mnt/server/share/file.txt
-
Convert Cygwin path to quoted Windows path:
stv_path -d linux-to-win "/cygdrive/d/My Documents" --quote always # Output: "D:\My Documents"
-
Batch convert paths from a file:
stv_path -i paths.txt
Project Structure 🌳
.
├── LICENSE
├── README.md
├── pyproject.toml
└── src
└── stv_path_converter
├── __init__.py
├── core
│ ├── __init__.py
│ ├── converter.py # Core conversion logic
│ └── stv_parse.py # Path parsing utilities
├── main.py # CLI entry point
├── text
│ ├── __init__.py
│ └── change_text.py # Text formatting helpers
└── utils
├── __init__.py
├── head.py # Header utilities
└── lic.py # License management
Contribution Guidelines 🤝
Contributions are welcome! Feel free to submit issues and PRs anytime!
License 📜
This project is licensed under the MIT License. See LICENSE for details.
🛠️ Crafted for cross-platform developers.
Version Highlights
- Localization Optimization: Technical terminology tailored for Chinese users
- Format Adaptation: Complies with Chinese punctuation and typesetting conventions
- Scenario-Based Examples: Practical demonstrations aligned with real development needs
- Clear Structure: Maintains consistent hierarchy with the English version
Metadata
Release files for stv-path-converter 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stv_path_converter-0.0.1.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stv_path_converter-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / stv_path_converter-0.0.1.tar.gz
| Download URL | stv_path_converter-0.0.1.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2d6b8036c8dfe69eda886833c5b46afd60a9ab6c7d73488e6859bfa0b1446ed
|
|
BLAKE2b-256 checksum How to use checksums |
854c627bf534332dbf9a7771dc54bb084b5daab9c6aa9187cdeb1bf2bebfbab3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / stv_path_converter-0.0.1-py3-none-any.whl
| Download URL | stv_path_converter-0.0.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8af69e5a886cba9b939fcdd0a97d70c6451ca645b5c793f5b5441b5767bb10a
|
|
BLAKE2b-256 checksum How to use checksums |
d9b88db85c1eadc2aaad807c61ba084b794302e2355e14b648a925d76f0fdf32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|