mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 15:17:57 -05:00
tau: Do not print unnecessary table data when piping task table output
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -5946,6 +5946,7 @@ dependencies = [
|
||||
"clap 4.3.21",
|
||||
"colored",
|
||||
"darkfi",
|
||||
"libc",
|
||||
"libsqlite3-sys",
|
||||
"log",
|
||||
"prettytable-rs",
|
||||
|
||||
@@ -9,6 +9,7 @@ homepage = "https://dark.fi"
|
||||
repository = "https://github.com/darkrenaissance/darkfi"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2.147"
|
||||
darkfi = { path = "../../../", features = ["rpc"]}
|
||||
|
||||
# Async
|
||||
|
||||
@@ -117,8 +117,18 @@ pub fn print_task_list(tasks: Vec<TaskInfo>, ws: String) -> Result<()> {
|
||||
.build(),
|
||||
);
|
||||
|
||||
ws_table.printstd();
|
||||
table.printstd();
|
||||
if unsafe { libc::isatty(libc::STDOUT_FILENO) } == 1 {
|
||||
ws_table.printstd();
|
||||
table.printstd();
|
||||
} else {
|
||||
for row in table.row_iter() {
|
||||
for cell in row.iter() {
|
||||
print!("{}\t", cell.get_content());
|
||||
}
|
||||
print!("\n");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user