Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--help output use line wrap #11991

Closed
wants to merge 11 commits into from
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug Report
description: Create a report to help us improve
labels: ["C-bug"]
labels: ["C-bug", "S-triage"]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Feature Request
description: Suggest an idea for enhancing Cargo
labels: ["C-feature-request"]
labels: ["C-feature-request", "S-triage"]
body:
- type: markdown
attributes:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ jobs:
# TODO: check every members
- run: cargo clippy -p cargo --lib --no-deps -- -D warnings

# Ensure Cargo.lock is up-to-date
lockfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update stable && rustup default stable
- run: cargo update -p cargo --locked

test:
runs-on: ${{ matrix.os }}
env:
Expand Down
15 changes: 13 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 3 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
[workspace]
resolver = "2"
members = [
"crates/*",
"credential/*",
"benches/benchsuite",
"benches/capture",
"crates/cargo-platform",
"crates/cargo-test-macro",
"crates/cargo-test-support",
"crates/cargo-util",
"crates/crates-io",
"crates/credential/*",
"crates/home",
"crates/mdman",
"crates/resolver-tests",
]
exclude = [
# For linkchecker (downloaded during CI) and semver-check
Expand Down Expand Up @@ -44,7 +37,7 @@ base64 = "0.21.0"
bytesize = "1.0"
cargo-platform = { path = "crates/cargo-platform", version = "0.1.2" }
cargo-util = { path = "crates/cargo-util", version = "0.2.4" }
clap = "4.2.0"
clap = { version = "4.2.0", features = ["wrap_help"] }
crates-io = { path = "crates/crates-io", version = "0.36.0" }
curl = { version = "0.4.44", features = ["http2"] }
curl-sys = "0.4.61"
Expand Down
6 changes: 3 additions & 3 deletions ci/validate-man.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e

cd src/doc

changes=$(git status --porcelain)
changes=$(git status --porcelain -- .)
if [ -n "$changes" ]
then
echo "git directory must be clean before running this script."
Expand All @@ -14,10 +14,10 @@ fi

./build-man.sh

changes=$(git status --porcelain)
changes=$(git status --porcelain -- .)
if [ -n "$changes" ]
then
echo "Detected changes in man pages:"
echo "Detected changes of man pages in src/doc:"
echo "$changes"
echo
echo "Please run './build-man.sh' in the src/doc directory to rebuild the"
Expand Down
50 changes: 0 additions & 50 deletions crates/credential/cargo-credential-macos-keychain/src/main.rs

This file was deleted.

111 changes: 0 additions & 111 deletions crates/credential/cargo-credential-wincred/src/main.rs

This file was deleted.

File renamed without changes.
58 changes: 58 additions & 0 deletions credential/cargo-credential-macos-keychain/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//! Cargo registry macos keychain credential process.

#[cfg(target_os = "macos")]
mod macos {
use cargo_credential::{Credential, Error};
use security_framework::os::macos::keychain::SecKeychain;

pub(crate) struct MacKeychain;

/// The account name is not used.
const ACCOUNT: &'static str = "";

fn registry(registry_name: &str) -> String {
format!("cargo-registry:{}", registry_name)
}

impl Credential for MacKeychain {
fn name(&self) -> &'static str {
env!("CARGO_PKG_NAME")
}

fn get(&self, index_url: &str) -> Result<String, Error> {
let keychain = SecKeychain::default().unwrap();
let service_name = registry(index_url);
let (pass, _item) = keychain.find_generic_password(&service_name, ACCOUNT)?;
String::from_utf8(pass.as_ref().to_vec())
.map_err(|_| "failed to convert token to UTF8".into())
}

fn store(&self, index_url: &str, token: &str, name: Option<&str>) -> Result<(), Error> {
let keychain = SecKeychain::default().unwrap();
let service_name = registry(name.unwrap_or(index_url));
if let Ok((_pass, mut item)) = keychain.find_generic_password(&service_name, ACCOUNT) {
item.set_password(token.as_bytes())?;
} else {
keychain.add_generic_password(&service_name, ACCOUNT, token.as_bytes())?;
}
Ok(())
}

fn erase(&self, index_url: &str) -> Result<(), Error> {
let keychain = SecKeychain::default().unwrap();
let service_name = registry(index_url);
let (_pass, item) = keychain.find_generic_password(&service_name, ACCOUNT)?;
item.delete();
Ok(())
}
}
}

#[cfg(not(target_os = "macos"))]
use cargo_credential::UnsupportedCredential as MacKeychain;
#[cfg(target_os = "macos")]
use macos::MacKeychain;

fn main() {
cargo_credential::main(MacKeychain);
}
Loading