Skip to main content

bridge_argv

Function bridge_argv 

Source
pub fn bridge_argv(
    entry: &BridgeEntry,
    argv: &[String],
    network: bool,
) -> Vec<String>
Expand description

The argv actually launched for a bridge probe: the rule’s argv plus the entry’s enforced flags and hermetic flag (skipping flags already present). network drops the hermetic flag only where the entry deems it meaningful.

§Examples

use coding_tools::rules::{bridge_argv, BRIDGE};

let deny = &BRIDGE[2]; // cargo deny check
let argv: Vec<String> = ["cargo", "deny", "check", "bans"].iter().map(|s| s.to_string()).collect();
assert!(bridge_argv(deny, &argv, false).contains(&"--offline".to_string()));
assert!(!bridge_argv(deny, &argv, true).contains(&"--offline".to_string()));

let tree = &BRIDGE[1]; // cargo tree: network is not meaningful — offline stays
let argv: Vec<String> = ["cargo", "tree", "-d"].iter().map(|s| s.to_string()).collect();
assert!(bridge_argv(tree, &argv, true).contains(&"--offline".to_string()));
assert!(bridge_argv(tree, &argv, true).contains(&"--locked".to_string()));