/// Process the command options and retirieve the data accordingly
Process the command options and retirieve the data accordingly
Process the command options and retirieve the data accordingly
pub fn process_account(
    client: &mut RestClient,
    matches: &ArgMatches,
) -> Result<String, serde_json::error::Error> {
    if matches.is_present("all") {
        let accounts: Accounts = client.get(()).unwrap();
        return to_string_pretty(&accounts);
    }
    if let Some(institute) = matches.value_of("institute") {
        if let Some(login) = matches.value_of("institute login") {
            let account: Account = client.get((&InstituteA(institute.to_string()), &InstituteLoginA(login.to_string()))).unwrap();
            return to_string_pretty(&account);
        }
    }
    if let Some(timestamp) = matches.value_of("modified") {
        let accounts: Accounts = client.get(&TimeStampA(timestamp.to_string())).unwrap();
        return to_string_pretty(&accounts);
    }
    let vsc_id = matches
        .value_of("vscid")
        .expect("You should provide a vsc id if not getting non-specific account info");
    let account: Account = client.get(&VscIDA(vsc_id.to_string())).unwrap();
    to_string_pretty(&account)
}
pub fn process_account ( client : & mut RestClient , matches : & ArgMatches , ) -> Result < String , serde_json :: error :: Error > { if matches . is_present ( " " ) { let accounts : Accounts = client . get ( ( ) ) . unwrap ( ) ; return to_string_pretty ( & accounts ) ; } if let Some ( institute ) = matches . value_of ( " " ) { if let Some ( login ) = matches . value_of ( " " ) { let account : Account = client . get ( ( & InstituteA ( institute . to_string ( ) ) , & InstituteLoginA ( login . to_string ( ) ) ) ) . unwrap ( ) ; return to_string_pretty ( & account ) ; } } if let Some ( timestamp ) = matches . value_of ( " " ) { let accounts : Accounts = client . get ( & TimeStampA ( timestamp . to_string ( ) ) ) . unwrap ( ) ; return to_string_pretty ( & accounts ) ; } let vsc_id = matches . value_of ( " " ) . expect ( " " ) ; let account : Account = client . get ( & VscIDA ( vsc_id . to_string ( ) ) ) . unwrap ( ) ; to_string_pretty ( & account ) }
Process the command options and retirieve the data accordingly
Process the command options and retirieve the data accordingly
client
&mut RestClient
matches
&ArgMatches