add list of installed plugins to version command (#3548)

This commit is contained in:
Darren Schroeder 2021-06-03 08:53:32 -05:00 committed by GitHub
parent 8b193db0cb
commit 13257004bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 2 deletions

4
Cargo.lock generated
View File

@ -827,7 +827,7 @@ checksum = "e68bbd985a63de680ab4d1ad77b6306611a8f961b282c8b5ab513e6de934e396"
dependencies = [
"cfg-if 1.0.0",
"libc",
"serde 1.0.125",
"serde 1.0.126",
"winapi 0.3.9",
]
@ -2137,7 +2137,7 @@ dependencies = [
"proc-macro-hack",
"proc-macro2",
"quote 1.0.9",
"syn 1.0.71",
"syn 1.0.72",
]
[[package]]

View File

@ -140,6 +140,43 @@ pub fn version(args: CommandArgs) -> Result<ActionStream, ShellError> {
features_enabled().join(", ").to_string_value_create_tag(),
);
// Manually create a list of all possible plugin names
let all_plugins = vec![
"fetch",
"inc",
"match",
"post",
"ps",
"sys",
"textview",
"binaryview",
"chart bar",
"chart line",
"from bson",
"from sqlite",
"query json",
"s3",
"selector",
"start",
"to bson",
"to sqlite",
"tree",
"xpath",
];
// Get a list of command names and check for plugins
let installed_plugins = args
.scope()
.get_command_names()
.into_iter()
.filter(|cmd| all_plugins.contains(&cmd.as_str()))
.collect::<Vec<_>>();
indexmap.insert(
"installed_plugins".to_string(),
installed_plugins.join(", ").to_string_value_create_tag(),
);
let value = UntaggedValue::Row(Dictionary::from(indexmap)).into_value(&tag);
Ok(ActionStream::one(value))
}