mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Add new option to --disable-telemetry
to disable quickinstall statistics collection (#1831)
* Add new option `--disable-quick-install-stats` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Send quickinstall stats in parallel This commit also make sure'the stats is always sent for each fetcher, regardless of whether it is picked or not, to make sure that the quick-install stats collection gets the full infomration of possible targets. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Rename option to `--disable-telemetry` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Update args.rs Co-authored-by: Félix Saparelli <felix@passcod.name> Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Update args.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Co-authored-by: Félix Saparelli <felix@passcod.name>
This commit is contained in:
parent
fa105bb8d7
commit
6809601273
6 changed files with 36 additions and 3 deletions
|
@ -219,6 +219,14 @@ pub struct Args {
|
|||
#[clap(help_heading = "Options", long)]
|
||||
pub(crate) no_track: bool,
|
||||
|
||||
/// Disable statistics collection on popular crates.
|
||||
///
|
||||
/// Strategy quick-install (can be disabled via --disable-strategies) collects
|
||||
/// statistics of popular crates by default, by sending the crate, version and
|
||||
/// target to https://warehouse-clerk-tmp.vercel.app/api/crate
|
||||
#[clap(help_heading = "Options", long, env = "BINSTALL_DISABLE_TELEMETRY")]
|
||||
pub(crate) disable_telemetry: bool,
|
||||
|
||||
/// Install binaries in a custom location.
|
||||
///
|
||||
/// By default, binaries are installed to the global location `$CARGO_HOME/bin`, and global
|
||||
|
@ -611,5 +619,21 @@ mod test {
|
|||
Args::command().debug_assert()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn quickinstall_url_matches() {
|
||||
let long_help = Args::command()
|
||||
.get_opts()
|
||||
.find(|opt| opt.get_long() == Some("disable-telemetry"))
|
||||
.unwrap()
|
||||
.get_long_help()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
assert!(
|
||||
long_help.ends_with(binstalk::QUICK_INSTALL_STATS_URL),
|
||||
"{}",
|
||||
long_help
|
||||
);
|
||||
}
|
||||
|
||||
const _: () = assert!(Strategy::VARIANTS.len() == StrategyWrapped::VARIANTS.len());
|
||||
}
|
||||
|
|
|
@ -207,6 +207,7 @@ pub fn install_crates(
|
|||
} else {
|
||||
SignaturePolicy::IfPresent
|
||||
},
|
||||
disable_telemetry: args.disable_telemetry,
|
||||
});
|
||||
|
||||
// Destruct args before any async function to reduce size of the future
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue