feat: add optional feature flags for clipboard and url-open (P5.15)

Implemented feature flags to make dependencies optional:
- clipboard feature: controls arboard dependency
- url-open feature: controls open dependency
- Both enabled by default for backward compatibility

Changes:
- Cargo.toml: Added [features] section with optional deps
- src/input/main_input.rs: Conditional compilation for open::that() and copy_to_clipboard()
- tests/copy.rs: Clipboard tests only compile with feature enabled
- Graceful degradation: user-friendly error messages when features disabled

Benefits:
- Smaller binary size when features disabled
- Modular functionality
- Better platform compatibility

Progress: Priority 5: 1/3 tasks, Total: 17/20 (85%)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Mikhail Kilin
2026-02-01 02:23:17 +03:00
parent 38b18e35ea
commit 56bddabbe1
5 changed files with 63 additions and 22 deletions

View File

@@ -9,6 +9,11 @@ repository = "https://github.com/your-username/tele-tui"
keywords = ["telegram", "tui", "terminal", "cli"]
categories = ["command-line-utilities"]
[features]
default = ["clipboard", "url-open"]
clipboard = ["dep:arboard"]
url-open = ["dep:open"]
[dependencies]
ratatui = "0.29"
crossterm = "0.28"
@@ -18,8 +23,8 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
dotenvy = "0.15"
chrono = "0.4"
open = "5.0"
arboard = "3.4"
open = { version = "5.0", optional = true }
arboard = { version = "3.4", optional = true }
toml = "0.8"
dirs = "5.0"
thiserror = "1.0"