summaryrefslogtreecommitdiffstats
path: root/src/editor.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-03-05 00:19:48 +0800
committerGitHub <noreply@github.com>2023-03-05 00:19:48 +0800
commita055d4bee697c2dbf600afbd768e840b0f040247 (patch)
treede7960a847c1b0f7687e97b9c1a20caab2cc6f51 /src/editor.rs
parent5179b9a827cd889fdf72d014aa9cee0c2cc6f0f1 (diff)
downloadaichat-a055d4bee697c2dbf600afbd768e840b0f040247.tar.gz
feat: add `.copy` command (#10)
Diffstat (limited to 'src/editor.rs')
-rw-r--r--src/editor.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/editor.rs b/src/editor.rs
index 8355c01..1da71a1 100644
--- a/src/editor.rs
+++ b/src/editor.rs
@@ -1,7 +1,6 @@
use std::io::{self, Stdout, Write};
-use anyhow::{anyhow, Result};
-use copypasta::{ClipboardContext, ClipboardProvider};
+use anyhow::Result;
use crossterm::{
cursor,
@@ -10,6 +9,8 @@ use crossterm::{
terminal::{self, disable_raw_mode, enable_raw_mode},
};
+use crate::utils::paste;
+
pub fn edit() -> Result<String> {
enable_raw_mode()?;
let mut stdout = io::stdout();
@@ -107,8 +108,3 @@ impl<'a, T: Write> Session<'a, T> {
Ok(())
}
}
-
-fn paste() -> Result<String> {
- let mut ctx = ClipboardContext::new().map_err(|err| anyhow!("{err}"))?;
- ctx.get_contents().map_err(|err| anyhow!("{err}"))
-}