-
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.
Merge pull request #11 from rruckley/feat-module-tmf648
feat: Module tmf648
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
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,49 @@ | ||
//! TMF648 CLI Module | ||
//! TMF629 CLI Module | ||
use clap::Subcommand; | ||
|
||
use super::{ | ||
display_desc, | ||
display_opt, | ||
iterate_name, | ||
TMFOperation | ||
}; | ||
|
||
use tmf_client::common::tmf_error::TMFError; | ||
use tmf_client::{Operations, QueryOptions, TMFClient}; | ||
|
||
#[derive(Subcommand, Clone, Debug)] | ||
pub enum TMF648Modules { | ||
Quote { | ||
#[command(subcommand, help = "Product Quote")] | ||
op : TMFOperation | ||
}, | ||
} | ||
|
||
pub fn handle_tmf648(client : &mut TMFClient, module : TMF648Modules, opts : Option<QueryOptions>) -> Result<(),TMFError> { | ||
match module { | ||
TMF648Modules::Quote { op } => { | ||
match op { | ||
TMFOperation::List => { | ||
let quotes = client.tmf648().quote().list(opts)?; | ||
iterate_name("es); | ||
Ok(()) | ||
}, | ||
TMFOperation::Get { id } => { | ||
let quote = client.tmf648().quote().get(id)?; | ||
let the_first = quote.first().unwrap(); | ||
display_desc(the_first); | ||
display_opt("Category",&the_first.category); | ||
display_opt("Version",&the_first.version); | ||
// display_opt("External Id",&the_f) | ||
Ok(()) | ||
} | ||
_ => { | ||
Err(TMFError::from("Not implemented")) | ||
} | ||
} | ||
}, | ||
} | ||
} |