mirror of
https://github.com/nushell/nushell
synced 2024-11-14 00:47:09 +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"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fb58b6451e8c2a812ad979ed1d83378caa5e927eef2622017a45f251457c2c9d"
|
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]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -1283,9 +1303,9 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git2"
|
name = "git2"
|
||||||
version = "0.13.25"
|
version = "0.14.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6"
|
checksum = "3826a6e0e2215d7a41c2bfc7c9244123969273f3476b939a226aac0ab56e9e3c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -1763,9 +1783,9 @@ checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libgit2-sys"
|
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"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494"
|
checksum = "3a42de9a51a5c12e00fc0e4ca6bc2ea43582fc6418488e8f615e905d886f258b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -3867,11 +3887,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shadow-rs"
|
name = "shadow-rs"
|
||||||
version = "0.8.1"
|
version = "0.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8935e920eb80ff8f5a5bced990325d12f6cc1015154a3852c6a23cf5bd71c447"
|
checksum = "f47e98e36909e951f4da3908f4475f969bec92a41734dd92e883aaa11c10294b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
|
"const_format",
|
||||||
"git2",
|
"git2",
|
||||||
"is_debug",
|
"is_debug",
|
||||||
]
|
]
|
||||||
|
|
|
@ -66,7 +66,7 @@ serde_ini = "0.2.0"
|
||||||
serde_urlencoded = "0.7.0"
|
serde_urlencoded = "0.7.0"
|
||||||
serde_yaml = "0.8.16"
|
serde_yaml = "0.8.16"
|
||||||
sha2 = "0.10.0"
|
sha2 = "0.10.0"
|
||||||
shadow-rs = "0.8.1"
|
shadow-rs = "0.11.0"
|
||||||
strip-ansi-escapes = "0.1.1"
|
strip-ansi-escapes = "0.1.1"
|
||||||
sysinfo = "0.23.5"
|
sysinfo = "0.23.5"
|
||||||
terminal_size = "0.1.17"
|
terminal_size = "0.1.17"
|
||||||
|
@ -106,7 +106,7 @@ plugin = ["nu-parser/plugin"]
|
||||||
dataframe = ["polars", "num"]
|
dataframe = ["polars", "num"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
shadow-rs = "0.8.1"
|
shadow-rs = "0.11.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hamcrest2 = "0.3.0"
|
hamcrest2 = "0.3.0"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use indexmap::IndexMap;
|
|
||||||
use nu_protocol::ast::Call;
|
use nu_protocol::ast::Call;
|
||||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||||
use nu_protocol::{Example, IntoPipelineData, PipelineData, ShellError, Signature, Value};
|
use nu_protocol::{Example, IntoPipelineData, PipelineData, ShellError, Signature, Value};
|
||||||
|
@ -49,144 +48,130 @@ pub fn version(
|
||||||
_input: PipelineData,
|
_input: PipelineData,
|
||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let tag = call.head;
|
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(
|
cols.push("branch".to_string());
|
||||||
"version".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: shadow_rs::branch(),
|
||||||
val: env!("CARGO_PKG_VERSION").to_string(),
|
span: call.head,
|
||||||
span: tag,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
let branch: Option<&str> = Some(shadow::BRANCH).filter(|x| !x.is_empty());
|
cols.push("tag".to_string());
|
||||||
if let Some(branch) = branch {
|
vals.push(Value::String {
|
||||||
indexmap.insert(
|
val: shadow_rs::tag(),
|
||||||
"branch".to_string(),
|
span: call.head,
|
||||||
Value::String {
|
});
|
||||||
val: branch.to_string(),
|
|
||||||
span: call.head,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let short_commit: Option<&str> = Some(shadow::SHORT_COMMIT).filter(|x| !x.is_empty());
|
let short_commit: Option<&str> = Some(shadow::SHORT_COMMIT).filter(|x| !x.is_empty());
|
||||||
if let Some(short_commit) = short_commit {
|
if let Some(short_commit) = short_commit {
|
||||||
indexmap.insert(
|
cols.push("short_commit".to_string());
|
||||||
"short_commit".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: short_commit.to_string(),
|
||||||
val: short_commit.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
let commit_hash: Option<&str> = Some(shadow::COMMIT_HASH).filter(|x| !x.is_empty());
|
let commit_hash: Option<&str> = Some(shadow::COMMIT_HASH).filter(|x| !x.is_empty());
|
||||||
if let Some(commit_hash) = commit_hash {
|
if let Some(commit_hash) = commit_hash {
|
||||||
indexmap.insert(
|
cols.push("commit_hash".to_string());
|
||||||
"commit_hash".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: commit_hash.to_string(),
|
||||||
val: commit_hash.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
let commit_date: Option<&str> = Some(shadow::COMMIT_DATE).filter(|x| !x.is_empty());
|
let commit_date: Option<&str> = Some(shadow::COMMIT_DATE).filter(|x| !x.is_empty());
|
||||||
if let Some(commit_date) = commit_date {
|
if let Some(commit_date) = commit_date {
|
||||||
indexmap.insert(
|
cols.push("commit_date".to_string());
|
||||||
"commit_date".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: commit_date.to_string(),
|
||||||
val: commit_date.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let build_os: Option<&str> = Some(shadow::BUILD_OS).filter(|x| !x.is_empty());
|
let build_os: Option<&str> = Some(shadow::BUILD_OS).filter(|x| !x.is_empty());
|
||||||
if let Some(build_os) = build_os {
|
if let Some(build_os) = build_os {
|
||||||
indexmap.insert(
|
cols.push("build_os".to_string());
|
||||||
"build_os".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: build_os.to_string(),
|
||||||
val: build_os.to_string(),
|
span: call.head,
|
||||||
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());
|
let rust_version: Option<&str> = Some(shadow::RUST_VERSION).filter(|x| !x.is_empty());
|
||||||
if let Some(rust_version) = rust_version {
|
if let Some(rust_version) = rust_version {
|
||||||
indexmap.insert(
|
cols.push("rust_version".to_string());
|
||||||
"rust_version".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: rust_version.to_string(),
|
||||||
val: rust_version.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let rust_channel: Option<&str> = Some(shadow::RUST_CHANNEL).filter(|x| !x.is_empty());
|
let rust_channel: Option<&str> = Some(shadow::RUST_CHANNEL).filter(|x| !x.is_empty());
|
||||||
if let Some(rust_channel) = rust_channel {
|
if let Some(rust_channel) = rust_channel {
|
||||||
indexmap.insert(
|
cols.push("rust_channel".to_string());
|
||||||
"rust_channel".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: rust_channel.to_string(),
|
||||||
val: rust_channel.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let cargo_version: Option<&str> = Some(shadow::CARGO_VERSION).filter(|x| !x.is_empty());
|
let cargo_version: Option<&str> = Some(shadow::CARGO_VERSION).filter(|x| !x.is_empty());
|
||||||
if let Some(cargo_version) = cargo_version {
|
if let Some(cargo_version) = cargo_version {
|
||||||
indexmap.insert(
|
cols.push("cargo_version".to_string());
|
||||||
"cargo_version".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: cargo_version.to_string(),
|
||||||
val: cargo_version.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let pkg_version: Option<&str> = Some(shadow::PKG_VERSION).filter(|x| !x.is_empty());
|
let pkg_version: Option<&str> = Some(shadow::PKG_VERSION).filter(|x| !x.is_empty());
|
||||||
if let Some(pkg_version) = pkg_version {
|
if let Some(pkg_version) = pkg_version {
|
||||||
indexmap.insert(
|
cols.push("pkg_version".to_string());
|
||||||
"pkg_version".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: pkg_version.to_string(),
|
||||||
val: pkg_version.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let build_time: Option<&str> = Some(shadow::BUILD_TIME).filter(|x| !x.is_empty());
|
let build_time: Option<&str> = Some(shadow::BUILD_TIME).filter(|x| !x.is_empty());
|
||||||
if let Some(build_time) = build_time {
|
if let Some(build_time) = build_time {
|
||||||
indexmap.insert(
|
cols.push("build_time".to_string());
|
||||||
"build_time".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: build_time.to_string(),
|
||||||
val: build_time.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let build_rust_channel: Option<&str> =
|
let build_rust_channel: Option<&str> =
|
||||||
Some(shadow::BUILD_RUST_CHANNEL).filter(|x| !x.is_empty());
|
Some(shadow::BUILD_RUST_CHANNEL).filter(|x| !x.is_empty());
|
||||||
if let Some(build_rust_channel) = build_rust_channel {
|
if let Some(build_rust_channel) = build_rust_channel {
|
||||||
indexmap.insert(
|
cols.push("build_rust_channel".to_string());
|
||||||
"build_rust_channel".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: build_rust_channel.to_string(),
|
||||||
val: build_rust_channel.to_string(),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
indexmap.insert(
|
cols.push("features".to_string());
|
||||||
"features".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: features_enabled().join(", "),
|
||||||
val: features_enabled().join(", "),
|
span: call.head,
|
||||||
span: call.head,
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Get a list of command names and check for plugins
|
// Get a list of command names and check for plugins
|
||||||
let installed_plugins = engine_state
|
let installed_plugins = engine_state
|
||||||
|
@ -196,28 +181,12 @@ pub fn version(
|
||||||
.map(|x| x.name())
|
.map(|x| x.name())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
indexmap.insert(
|
cols.push("installed_plugins".to_string());
|
||||||
"installed_plugins".to_string(),
|
vals.push(Value::String {
|
||||||
Value::String {
|
val: installed_plugins.join(", "),
|
||||||
val: installed_plugins.join(", "),
|
span: call.head,
|
||||||
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 {
|
Ok(Value::Record {
|
||||||
cols,
|
cols,
|
||||||
vals,
|
vals,
|
||||||
|
|
|
@ -14,4 +14,4 @@ nu-plugin = { path="../nu-plugin", version = "0.60.1" }
|
||||||
nu-protocol = { path="../nu-protocol", version = "0.60.1" }
|
nu-protocol = { path="../nu-protocol", version = "0.60.1" }
|
||||||
nu-engine = { path="../nu-engine", 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