pub fn choose_local_campaign(action_string: &String) -> Box<CrowdfundingCampaign> {
    let mut camps = get_local_campaigns();
    if camps.len() == 0 {
        println!("You have no local Campaigns. Please create or track a Campaign first to interact with one."); 
        std::process::exit(0);
    }
    let mut n = 0;
    for camp in &camps {
        n += 1;
        camp.print_choice_text(n);
    }

    // Making the campaign selection text more context dependent.
    println!("\nWhich campaign would you like to {}?", action_string);


    // Get Campaign based on choice
    let mut input = String::new();
    if let Ok(_) = std::io::stdin().read_line(&mut input){
        if let Ok(input_n) = input.trim().parse::<usize>(){
            if input_n > get_local_campaigns().len() || input_n < 1 {
                println!("Please select a campaign within the range.");
                return choose_local_campaign(action_string);
            }
            return camps.remove(input_n-1);
        }
    }
    return choose_local_campaign(action_string);
}
/// Choose a campaign from those which are locally saved
Choose a campaign from those which are locally saved
Choose a campaign from those which are locally saved
pub fn choose_local_campaign(action_string: &String) -> Box<CrowdfundingCampaign> {
    let mut camps = get_local_campaigns();
    if camps.len() == 0 {
        println!("You have no local Campaigns. Please create or track a Campaign first to interact with one."); 
        std::process::exit(0);
    }
    let mut n = 0;
    for camp in &camps {
        n += 1;
        camp.print_choice_text(n);
    }
    // Making the campaign selection text more context dependent.
    println!("\nWhich campaign would you like to {}?", action_string);
    // Get Campaign based on choice
    let mut input = String::new();
    if let Ok(_) = std::io::stdin().read_line(&mut input){
        if let Ok(input_n) = input.trim().parse::<usize>(){
            if input_n > get_local_campaigns().len() || input_n < 1 {
                println!("Please select a campaign within the range.");
                return choose_local_campaign(action_string);
            }
            return camps.remove(input_n-1);
        }
    }
    return choose_local_campaign(action_string);
}
pub fn choose_local_campaign ( action_string : & String ) -> Box < CrowdfundingCampaign > { let mut camps = get_local_campaigns ( ) ; if camps . len ( ) == 0 { println ! ( " " ) ; std :: process :: exit ( 0 ) ; } let mut n = 0 ; for camp in & camps { n += 1 ; camp . print_choice_text ( n ) ; } // Making the campaign selection text more context dependent. println ! ( " \n " action_string ) ; // Get Campaign based on choice let mut input = String :: new ( ) ; if let Ok ( _ ) = std :: io :: stdin ( ) . read_line ( & mut input ) { if let Ok ( input_n ) = input . trim ( ) . parse :: < usize > ( ) { if input_n > get_local_campaigns ( ) . len ( ) || input_n < 1 { println ! ( " " ) ; return choose_local_campaign ( action_string ) ; } return camps . remove ( input_n - 1 ) ; } } return choose_local_campaign ( action_string ) ; }
Choose a campaign from those which are locally saved
Choose a campaign from those which are locally saved
action_string
&String
action_string
&String