termux/clipboard.rs
1use crate::*;
2
3/// Get the system clipboard text.
4pub fn get() -> io::Result<String> {
5 run_api_cmd("Clipboard")
6}
7
8/// Set the system clipboard text.
9pub fn set(text: &str) -> io::Result<()> {
10 run_cmd("termux-clipboard-set", text)
11}
12
13#[test]
14fn test_set_and_get() {
15 let _ = set("Some text...\nSome more text...");
16 assert_eq!(&get().unwrap(), "Some text...\nSome more text...")
17}