mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +00:00
update shadow-rs, update git2, remove indexmap from version
(#5086)
This commit is contained in:
parent
608b6f3634
commit
4654f03d31
4 changed files with 116 additions and 126 deletions
33
Cargo.lock
generated
33
Cargo.lock
generated
|
@ -544,6 +544,26 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb58b6451e8c2a812ad979ed1d83378caa5e927eef2622017a45f251457c2c9d"
|
||||
|
||||
[[package]]
|
||||
name = "const_format"
|
||||
version = "0.2.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22bc6cd49b0ec407b680c3e380182b6ac63b73991cb7602de350352fc309b614"
|
||||
dependencies = [
|
||||
"const_format_proc_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const_format_proc_macros"
|
||||
version = "0.2.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef196d5d972878a48da7decb7686eded338b4858fbabeed513d63a7c98b2b82d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.4.0"
|
||||
|
@ -1283,9 +1303,9 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
|
|||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.13.25"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6"
|
||||
checksum = "3826a6e0e2215d7a41c2bfc7c9244123969273f3476b939a226aac0ab56e9e3c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
|
@ -1763,9 +1783,9 @@ checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
|
|||
|
||||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.12.26+1.3.0"
|
||||
version = "0.13.2+1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494"
|
||||
checksum = "3a42de9a51a5c12e00fc0e4ca6bc2ea43582fc6418488e8f615e905d886f258b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
|
@ -3867,11 +3887,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "shadow-rs"
|
||||
version = "0.8.1"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8935e920eb80ff8f5a5bced990325d12f6cc1015154a3852c6a23cf5bd71c447"
|
||||
checksum = "f47e98e36909e951f4da3908f4475f969bec92a41734dd92e883aaa11c10294b"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"const_format",
|
||||
"git2",
|
||||
"is_debug",
|
||||
]
|
||||
|
|
|
@ -66,7 +66,7 @@ serde_ini = "0.2.0"
|
|||
serde_urlencoded = "0.7.0"
|
||||
serde_yaml = "0.8.16"
|
||||
sha2 = "0.10.0"
|
||||
shadow-rs = "0.8.1"
|
||||
shadow-rs = "0.11.0"
|
||||
strip-ansi-escapes = "0.1.1"
|
||||
sysinfo = "0.23.5"
|
||||
terminal_size = "0.1.17"
|
||||
|
@ -106,7 +106,7 @@ plugin = ["nu-parser/plugin"]
|
|||
dataframe = ["polars", "num"]
|
||||
|
||||
[build-dependencies]
|
||||
shadow-rs = "0.8.1"
|
||||
shadow-rs = "0.11.0"
|
||||
|
||||
[dev-dependencies]
|
||||
hamcrest2 = "0.3.0"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use indexmap::IndexMap;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Example, IntoPipelineData, PipelineData, ShellError, Signature, Value};
|
||||
|
@ -49,144 +48,130 @@ pub fn version(
|
|||
_input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let tag = call.head;
|
||||
let mut cols = vec![];
|
||||
let mut vals = vec![];
|
||||
|
||||
let mut indexmap = IndexMap::with_capacity(4);
|
||||
cols.push("version".to_string());
|
||||
vals.push(Value::String {
|
||||
val: env!("CARGO_PKG_VERSION").to_string(),
|
||||
span: tag,
|
||||
});
|
||||
|
||||
indexmap.insert(
|
||||
"version".to_string(),
|
||||
Value::String {
|
||||
val: env!("CARGO_PKG_VERSION").to_string(),
|
||||
span: tag,
|
||||
},
|
||||
);
|
||||
cols.push("branch".to_string());
|
||||
vals.push(Value::String {
|
||||
val: shadow_rs::branch(),
|
||||
span: call.head,
|
||||
});
|
||||
|
||||
let branch: Option<&str> = Some(shadow::BRANCH).filter(|x| !x.is_empty());
|
||||
if let Some(branch) = branch {
|
||||
indexmap.insert(
|
||||
"branch".to_string(),
|
||||
Value::String {
|
||||
val: branch.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
}
|
||||
cols.push("tag".to_string());
|
||||
vals.push(Value::String {
|
||||
val: shadow_rs::tag(),
|
||||
span: call.head,
|
||||
});
|
||||
|
||||
let short_commit: Option<&str> = Some(shadow::SHORT_COMMIT).filter(|x| !x.is_empty());
|
||||
if let Some(short_commit) = short_commit {
|
||||
indexmap.insert(
|
||||
"short_commit".to_string(),
|
||||
Value::String {
|
||||
val: short_commit.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("short_commit".to_string());
|
||||
vals.push(Value::String {
|
||||
val: short_commit.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
let commit_hash: Option<&str> = Some(shadow::COMMIT_HASH).filter(|x| !x.is_empty());
|
||||
if let Some(commit_hash) = commit_hash {
|
||||
indexmap.insert(
|
||||
"commit_hash".to_string(),
|
||||
Value::String {
|
||||
val: commit_hash.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("commit_hash".to_string());
|
||||
vals.push(Value::String {
|
||||
val: commit_hash.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
let commit_date: Option<&str> = Some(shadow::COMMIT_DATE).filter(|x| !x.is_empty());
|
||||
if let Some(commit_date) = commit_date {
|
||||
indexmap.insert(
|
||||
"commit_date".to_string(),
|
||||
Value::String {
|
||||
val: commit_date.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("commit_date".to_string());
|
||||
vals.push(Value::String {
|
||||
val: commit_date.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
let build_os: Option<&str> = Some(shadow::BUILD_OS).filter(|x| !x.is_empty());
|
||||
if let Some(build_os) = build_os {
|
||||
indexmap.insert(
|
||||
"build_os".to_string(),
|
||||
Value::String {
|
||||
val: build_os.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("build_os".to_string());
|
||||
vals.push(Value::String {
|
||||
val: build_os.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
let build_target: Option<&str> = Some(shadow::BUILD_TARGET).filter(|x| !x.is_empty());
|
||||
if let Some(build_target) = build_target {
|
||||
cols.push("build_os".to_string());
|
||||
vals.push(Value::String {
|
||||
val: build_target.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
let rust_version: Option<&str> = Some(shadow::RUST_VERSION).filter(|x| !x.is_empty());
|
||||
if let Some(rust_version) = rust_version {
|
||||
indexmap.insert(
|
||||
"rust_version".to_string(),
|
||||
Value::String {
|
||||
val: rust_version.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("rust_version".to_string());
|
||||
vals.push(Value::String {
|
||||
val: rust_version.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
let rust_channel: Option<&str> = Some(shadow::RUST_CHANNEL).filter(|x| !x.is_empty());
|
||||
if let Some(rust_channel) = rust_channel {
|
||||
indexmap.insert(
|
||||
"rust_channel".to_string(),
|
||||
Value::String {
|
||||
val: rust_channel.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("rust_channel".to_string());
|
||||
vals.push(Value::String {
|
||||
val: rust_channel.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
let cargo_version: Option<&str> = Some(shadow::CARGO_VERSION).filter(|x| !x.is_empty());
|
||||
if let Some(cargo_version) = cargo_version {
|
||||
indexmap.insert(
|
||||
"cargo_version".to_string(),
|
||||
Value::String {
|
||||
val: cargo_version.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("cargo_version".to_string());
|
||||
vals.push(Value::String {
|
||||
val: cargo_version.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
let pkg_version: Option<&str> = Some(shadow::PKG_VERSION).filter(|x| !x.is_empty());
|
||||
if let Some(pkg_version) = pkg_version {
|
||||
indexmap.insert(
|
||||
"pkg_version".to_string(),
|
||||
Value::String {
|
||||
val: pkg_version.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("pkg_version".to_string());
|
||||
vals.push(Value::String {
|
||||
val: pkg_version.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
let build_time: Option<&str> = Some(shadow::BUILD_TIME).filter(|x| !x.is_empty());
|
||||
if let Some(build_time) = build_time {
|
||||
indexmap.insert(
|
||||
"build_time".to_string(),
|
||||
Value::String {
|
||||
val: build_time.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("build_time".to_string());
|
||||
vals.push(Value::String {
|
||||
val: build_time.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
let build_rust_channel: Option<&str> =
|
||||
Some(shadow::BUILD_RUST_CHANNEL).filter(|x| !x.is_empty());
|
||||
if let Some(build_rust_channel) = build_rust_channel {
|
||||
indexmap.insert(
|
||||
"build_rust_channel".to_string(),
|
||||
Value::String {
|
||||
val: build_rust_channel.to_string(),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("build_rust_channel".to_string());
|
||||
vals.push(Value::String {
|
||||
val: build_rust_channel.to_string(),
|
||||
span: call.head,
|
||||
});
|
||||
}
|
||||
|
||||
indexmap.insert(
|
||||
"features".to_string(),
|
||||
Value::String {
|
||||
val: features_enabled().join(", "),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("features".to_string());
|
||||
vals.push(Value::String {
|
||||
val: features_enabled().join(", "),
|
||||
span: call.head,
|
||||
});
|
||||
|
||||
// Get a list of command names and check for plugins
|
||||
let installed_plugins = engine_state
|
||||
|
@ -196,28 +181,12 @@ pub fn version(
|
|||
.map(|x| x.name())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
indexmap.insert(
|
||||
"installed_plugins".to_string(),
|
||||
Value::String {
|
||||
val: installed_plugins.join(", "),
|
||||
span: call.head,
|
||||
},
|
||||
);
|
||||
cols.push("installed_plugins".to_string());
|
||||
vals.push(Value::String {
|
||||
val: installed_plugins.join(", "),
|
||||
span: call.head,
|
||||
});
|
||||
|
||||
let cols = indexmap.keys().cloned().collect::<Vec<_>>();
|
||||
let vals = indexmap.values().cloned().collect::<Vec<_>>();
|
||||
|
||||
// Ok(Value::List {
|
||||
// vals: vec![Value::Record {
|
||||
// cols,
|
||||
// vals,
|
||||
// span: call.head,
|
||||
// }],
|
||||
// span: call.head,
|
||||
// }
|
||||
// .into_pipeline_data())
|
||||
|
||||
// List looks better than table, imo
|
||||
Ok(Value::Record {
|
||||
cols,
|
||||
vals,
|
||||
|
|
|
@ -14,4 +14,4 @@ nu-plugin = { path="../nu-plugin", version = "0.60.1" }
|
|||
nu-protocol = { path="../nu-protocol", version = "0.60.1" }
|
||||
nu-engine = { path="../nu-engine", version = "0.60.1" }
|
||||
|
||||
git2 = "0.13.24"
|
||||
git2 = "0.14.2"
|
||||
|
|
Loading…
Reference in a new issue