-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//! TMF629 CLI Module | ||
use clap::Subcommand; | ||
|
||
use super::{ | ||
display_name, iterate_name, TMFOperation | ||
}; | ||
|
||
use tmf_client::common::tmf_error::TMFError; | ||
use tmf_client::{Operations, QueryOptions, TMFClient}; | ||
|
||
#[derive(Subcommand, Clone, Debug)] | ||
pub enum TMF629Modules { | ||
Customer { | ||
#[command(subcommand, help = "Customer")] | ||
op : TMFOperation | ||
}, | ||
} | ||
|
||
pub fn handle_tmf629(client : &mut TMFClient, module : TMF629Modules, opts : Option<QueryOptions>) -> Result<(),TMFError> { | ||
match module { | ||
TMF629Modules::Customer { op } => { | ||
match op { | ||
TMFOperation::List => { | ||
let customers = client.tmf629().customer().list(opts)?; | ||
iterate_name(&customers); | ||
Ok(()) | ||
}, | ||
TMFOperation::Get { id } => { | ||
let customer = client.tmf629().customer().get(id)?; | ||
let the_first = customer.first().unwrap(); | ||
display_name(the_first); | ||
Ok(()) | ||
} | ||
_ => { | ||
Err(TMFError::from("Not implemented")) | ||
} | ||
} | ||
}, | ||
} | ||
} |