]> git.proxmox.com Git - proxmox-backup.git/commitdiff
remove pbs-tools/src/cli.rs
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Nov 2021 07:33:10 +0000 (08:33 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Nov 2021 07:33:10 +0000 (08:33 +0100)
Code is only used once in src/bin/proxmox_backup_debug/inspect.rs, so
move it into that file.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
pbs-tools/src/cli.rs [deleted file]
pbs-tools/src/lib.rs
src/bin/proxmox_backup_debug/inspect.rs

diff --git a/pbs-tools/src/cli.rs b/pbs-tools/src/cli.rs
deleted file mode 100644 (file)
index 62f17ac..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-use std::fs::File;
-use std::io::{self, stdout, Write};
-use std::path::Path;
-use std::panic::{RefUnwindSafe, UnwindSafe};
-
-/// Returns either a new file, if a path is given, or stdout, if no path is given.
-pub fn outfile_or_stdout<P: AsRef<Path>>(
-    path: Option<P>,
-) -> io::Result<Box<dyn Write + Send + Sync + Unpin + RefUnwindSafe + UnwindSafe>> {
-    if let Some(path) = path {
-        let f = File::create(path)?;
-        Ok(Box::new(f) as Box<_>)
-    } else {
-        Ok(Box::new(stdout()) as Box<_>)
-    }
-}
index bd5885cf5be5c3b40973bc6c13c627a9785d53aa..8c001222b98bbc4088cafd1df5a29ff7ccf6169d 100644 (file)
@@ -1,5 +1,4 @@
 pub mod cert;
-pub mod cli;
 pub mod crypt_config;
 pub mod format;
 pub mod io;
index fccb182a8a9b46d2b4dd4c2a63a090562c62faa9..9a1d0ac0bda58d4142ac5673efdf8c6e0c1cfb32 100644 (file)
@@ -1,7 +1,8 @@
 use std::collections::HashSet;
 use std::fs::File;
-use std::io::{Read, Seek, SeekFrom};
+use std::io::{stdout, Read, Seek, SeekFrom, Write};
 use std::path::Path;
+use std::panic::{RefUnwindSafe, UnwindSafe};
 
 use anyhow::{bail, format_err, Error};
 use serde_json::{json, Value};
@@ -14,7 +15,6 @@ use proxmox_router::cli::{
 };
 use proxmox_schema::api;
 
-use pbs_tools::cli::outfile_or_stdout;
 use pbs_tools::crypt_config::CryptConfig;
 use pbs_datastore::dynamic_index::DynamicIndexReader;
 use pbs_datastore::file_formats::{
@@ -27,6 +27,17 @@ use pbs_datastore::DataBlob;
 use pbs_config::key_config::load_and_decrypt_key;
 use pbs_client::tools::key_source::get_encryption_key_password;
 
+// Returns either a new file, if a path is given, or stdout, if no path is given.
+fn outfile_or_stdout<P: AsRef<Path>>(
+    path: Option<P>,
+) -> std::io::Result<Box<dyn Write + Send + Sync + Unpin + RefUnwindSafe + UnwindSafe>> {
+    if let Some(path) = path {
+        let f = File::create(path)?;
+        Ok(Box::new(f) as Box<_>)
+    } else {
+        Ok(Box::new(stdout()) as Box<_>)
+    }
+}
 
 /// Decodes a blob and writes its content either to stdout or into a file
 fn decode_blob(