aboutsummaryrefslogtreecommitdiff
path: root/bin/src/utils.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-12-29 05:23:38 +0000
committerAkshay <[email protected]>2022-01-08 10:33:10 +0000
commitd1ff222bcf94152cd657233cffd8c14a45788c26 (patch)
treefb8c94daefe0384a48b503fdd4bfaff905d78e2f /bin/src/utils.rs
parent94a2edf57340ac3f3a2276c88a221ba3125172af (diff)
allow for version based lints
Diffstat (limited to 'bin/src/utils.rs')
-rw-r--r--bin/src/utils.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/src/utils.rs b/bin/src/utils.rs
index 747a761..d374b4b 100644
--- a/bin/src/utils.rs
+++ b/bin/src/utils.rs
@@ -22,3 +22,14 @@ pub fn lint_map_of(
22pub fn lint_map() -> HashMap<SyntaxKind, Vec<&'static Box<dyn Lint>>> { 22pub fn lint_map() -> HashMap<SyntaxKind, Vec<&'static Box<dyn Lint>>> {
23 lint_map_of(&*LINTS) 23 lint_map_of(&*LINTS)
24} 24}
25
26pub fn get_version_info() -> Option<String> {
27 use std::process::Command;
28 let program = Command::new("nix")
29 .arg("--version")
30 .output()
31 .expect("failed to execute");
32 std::str::from_utf8(&program.stdout)
33 .ok()
34 .map(ToOwned::to_owned)
35}