-
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
1 parent
325d687
commit 8a1ab1b
Showing
5 changed files
with
68 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,15 +1,24 @@ | ||
//! Command Line Interface `Accounts` commands | ||
//! | ||
use crate::db; | ||
use crate::{db, starling::client::StarlingApiClient}; | ||
use anyhow::Result; | ||
|
||
pub async fn list() -> Result<()> { | ||
println!("Account list"); | ||
|
||
println!("Account list:"); | ||
for account in db::account::list().await? { | ||
println!("{:#?}", account.name); | ||
println!("- {:#?}", account.name); | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
pub async fn balance() -> Result<()> { | ||
println!("Account balances:"); | ||
for account in db::account::list().await? { | ||
let client = StarlingApiClient::new(&account.token); | ||
let balance = client.balance(&account.uid).await?; | ||
println!("- {}: {}", account.name, balance.effective.as_string()); | ||
} | ||
Ok(()) | ||
} |
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