pub fn initialize(options: Options) -> Result<StateHolder, Error> {
    let Options { directories, output_format, inspect, config_files, tags, exclude_tags, .. } =
        options;

    let action_tag_directive = action_tag_directive_from_tags(tags, exclude_tags);

    let mut inspect_contexts = Vec::new();
    inspect_contexts.push(InspectContext::initialize_from_file(inspect.unwrap())?);

    for directory in directories {
        let inspect_file = Path::new(&directory).join("inspect.json").into_os_string();
        match InspectContext::initialize_from_file(inspect_file.to_string_lossy().to_string()) {
            Ok(c) => inspect_contexts.push(c),
            Err(e) => println!("{}", e),
        };
    }

    if config_files.len() == 0 {
        bail!("Need at least one config file; use --config");
    }

    let mut config_file_map = HashMap::new();
    for file_name in config_files {
        let namespace = base_name(&file_name)?;
        let file_data = match fs::read_to_string(file_name.clone()) {
            Ok(data) => data,
            Err(_) => {
                bail!("Couldn't read config file '{}' to string", file_name);
            }
        };
        config_file_map.insert(namespace, file_data);
    }

    let ParseResult { actions, metrics, tests } =
        parse_config_files(config_file_map, action_tag_directive)?;

    validate(&metrics, &actions, &tests)?;

    Ok(StateHolder { metrics, actions, inspect_contexts, output_format })
}
/// Parses the inspect.json file and all the config files.
Parses the inspect.json file and all the config files.
Parses the inspect . json file and all the config files .
pub fn initialize(options: Options) -> Result<StateHolder, Error> {
    let Options { directories, output_format, inspect, config_files, tags, exclude_tags, .. } =
        options;
    let action_tag_directive = action_tag_directive_from_tags(tags, exclude_tags);
    let mut inspect_contexts = Vec::new();
    inspect_contexts.push(InspectContext::initialize_from_file(inspect.unwrap())?);
    for directory in directories {
        let inspect_file = Path::new(&directory).join("inspect.json").into_os_string();
        match InspectContext::initialize_from_file(inspect_file.to_string_lossy().to_string()) {
            Ok(c) => inspect_contexts.push(c),
            Err(e) => println!("{}", e),
        };
    }
    if config_files.len() == 0 {
        bail!("Need at least one config file; use --config");
    }
    let mut config_file_map = HashMap::new();
    for file_name in config_files {
        let namespace = base_name(&file_name)?;
        let file_data = match fs::read_to_string(file_name.clone()) {
            Ok(data) => data,
            Err(_) => {
                bail!("Couldn't read config file '{}' to string", file_name);
            }
        };
        config_file_map.insert(namespace, file_data);
    }
    let ParseResult { actions, metrics, tests } =
        parse_config_files(config_file_map, action_tag_directive)?;
    validate(&metrics, &actions, &tests)?;
    Ok(StateHolder { metrics, actions, inspect_contexts, output_format })
}
pub fn initialize ( options : Options ) -> Result < StateHolder , Error > { let Options { directories , output_format , inspect , config_files , tags , exclude_tags , .. } = options ; let action_tag_directive = action_tag_directive_from_tags ( tags , exclude_tags ) ; let mut inspect_contexts = Vec :: new ( ) ; inspect_contexts . push ( InspectContext :: initialize_from_file ( inspect . unwrap ( ) ) ? ) ; for directory in directories { let inspect_file = Path :: new ( & directory ) . join ( " " ) . into_os_string ( ) ; match InspectContext :: initialize_from_file ( inspect_file . to_string_lossy ( ) . to_string ( ) ) { Ok ( c ) => inspect_contexts . push ( c ) , Err ( e ) => println ! ( " " e ) , } ; } if config_files . len ( ) == 0 { bail ! ( " " ) ; } let mut config_file_map = HashMap :: new ( ) ; for file_name in config_files { let namespace = base_name ( & file_name ) ? ; let file_data = match fs :: read_to_string ( file_name . clone ( ) ) { Ok ( data ) => data , Err ( _ ) => { bail ! ( " " file_name ) ; } } ; config_file_map . insert ( namespace , file_data ) ; } let ParseResult { actions , metrics , tests } = parse_config_files ( config_file_map , action_tag_directive ) ? ; validate ( & metrics , & actions , & tests ) ? ; Ok ( StateHolder { metrics , actions , inspect_contexts , output_format } ) }
Parses the inspect.json file and all the config files.
Parses the inspect . json file and all the config files .
options
Options
options
Options