mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-03 11:41:04 +02:00
feat(cli): debug flag
This commit is contained in:
parent
a0cb01ae5f
commit
7413f78e04
3 changed files with 23 additions and 3 deletions
|
@ -8,7 +8,7 @@ use tokio::net::UnixStream;
|
|||
impl Ipc {
|
||||
/// Sends a command to the IPC server.
|
||||
/// The server response is returned.
|
||||
pub async fn send(&self, command: Command) -> Result<Response> {
|
||||
pub async fn send(&self, command: Command, debug: bool) -> Result<Response> {
|
||||
let mut stream = match UnixStream::connect(&self.path).await {
|
||||
Ok(stream) => Ok(stream),
|
||||
Err(err) => Err(Report::new(err)
|
||||
|
@ -17,6 +17,11 @@ impl Ipc {
|
|||
}?;
|
||||
|
||||
let write_buffer = serde_json::to_vec(&command)?;
|
||||
|
||||
if debug {
|
||||
eprintln!("REQUEST JSON: {}", serde_json::to_string(&command)?);
|
||||
}
|
||||
|
||||
stream.write_all(&write_buffer).await?;
|
||||
|
||||
let mut read_buffer = vec![0; 1024];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue