summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-09-13 20:26:47 +0200
committerMatthias Beyer <matthias.beyer@ifm.com>2022-09-13 20:26:47 +0200
commit2b0096920b10b271498400ebc362c10b3684882a (patch)
tree0e8b89608f9770c1506e029cd61cd2e92e472881
parent08a32f3294d65b4011e54838fc67c792cf8f3ff0 (diff)
Add tedge subcommand "bugreport"
For printing a quick markdown summary that can be used to be pasted into a bugreport at some code forge. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r--Cargo.lock56
-rw-r--r--tedge/Cargo.toml1
-rw-r--r--tedge/src/cli.rs3
-rw-r--r--tedge/src/lib.rs11
4 files changed, 71 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 0aa66dcb..179f3526 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -421,6 +421,17 @@ dependencies = [
]
[[package]]
+name = "bugreport"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "535120b8182547808081a66f1f77a64533c780b23da26763e0ee34dfb94f98c9"
+dependencies = [
+ "git-version",
+ "shell-escape",
+ "sys-info",
+]
+
+[[package]]
name = "bumpalo"
version = "3.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1390,6 +1401,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d"
[[package]]
+name = "git-version"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899"
+dependencies = [
+ "git-version-macro",
+ "proc-macro-hack",
+]
+
+[[package]]
+name = "git-version-macro"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f"
+dependencies = [
+ "proc-macro-hack",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.99",
+]
+
+[[package]]
name = "glob"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2716,6 +2749,12 @@ dependencies = [
]
[[package]]
+name = "proc-macro-hack"
+version = "0.5.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
+
+[[package]]
name = "proc-macro2"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3318,6 +3357,12 @@ dependencies = [
]
[[package]]
+name = "shell-escape"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
+
+[[package]]
name = "signal-hook"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3484,6 +3529,16 @@ dependencies = [
]
[[package]]
+name = "sys-info"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c"
+dependencies = [
+ "cc",
+ "libc",
+]
+
+[[package]]
name = "sysinfo"
version = "0.23.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3535,6 +3590,7 @@ dependencies = [
name = "tedge-cli"
version = "0.1.0"
dependencies = [
+ "bugreport",
"cfg-if 1.0.0",
"cfg_table",
"clap 3.2.18",
diff --git a/tedge/Cargo.toml b/tedge/Cargo.toml
index 9e81f7cd..9b89b2f2 100644
--- a/tedge/Cargo.toml
+++ b/tedge/Cargo.toml
@@ -31,6 +31,7 @@ termimad = "0.20.1"
term_size = "0.3.2"
owo-colors = "3.4.0"
textwrap = "0.15.0"
+bugreport = "0.5.0"
tedge_api = { path = "../crates/core/tedge_api" }
tedge_core = { path = "../crates/core/tedge_core" }
diff --git a/tedge/src/cli.rs b/tedge/src/cli.rs
index e01bc313..63730ccc 100644
--- a/tedge/src/cli.rs
+++ b/tedge/src/cli.rs
@@ -63,4 +63,7 @@ pub enum CliCommand {
/// Print the doc only for this plugin
plugin_name: Option<String>,
},
+
+ #[clap(name = "bugreport")]
+ BugReport,
}
diff --git a/tedge/src/lib.rs b/tedge/src/lib.rs
index 69cc0b3e..bf8482da 100644
--- a/tedge/src/lib.rs
+++ b/tedge/src/lib.rs
@@ -63,6 +63,17 @@ pub async fn run_app(args: crate::cli::Cli, registry: Registry) -> miette::Resul
Ok(())
}
+ cli::CliCommand::BugReport => {
+ use bugreport::collector::*;
+ bugreport::bugreport!()
+ .info(SoftwareVersion::default())
+ .info(OperatingSystem::default())
+ .info(CommandLine::default())
+ .info(EnvironmentVariables::list(&["SHELL"]))
+ .info(CompileTimeInformation::default())
+ .print::<bugreport::format::Markdown>();
+ Ok(())
+ }
}
}