mirror of
https://github.com/nushell/nushell.git
synced 2024-11-09 01:54:39 +01:00
585e104608
# Description This breaks out the core_commands into a separate crate called nu_cmd_lang _(Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes.)_ _(Description of your pull request goes here. **Provide examples and/or screenshots** if your changes affect the user experience.)_ # User-Facing Changes _(List of all changes that impact the user experience here. This helps us keep track of breaking changes.)_ # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
21 lines
658 B
Rust
21 lines
658 B
Rust
use std::process::Command;
|
|
|
|
fn main() -> shadow_rs::SdResult<()> {
|
|
// Look up the current Git commit ourselves instead of relying on shadow_rs,
|
|
// because shadow_rs does it in a really slow-to-compile way (it builds libgit2)
|
|
let hash = get_git_hash().unwrap_or_default();
|
|
println!("cargo:rustc-env=NU_COMMIT_HASH={hash}");
|
|
|
|
shadow_rs::new()
|
|
}
|
|
|
|
fn get_git_hash() -> Option<String> {
|
|
Command::new("git")
|
|
.args(["rev-parse", "HEAD"])
|
|
.output()
|
|
.ok()
|
|
.filter(|output| output.status.success())
|
|
.and_then(|output| String::from_utf8(output.stdout).ok())
|
|
.map(|hash| hash.trim().to_string())
|
|
}
|