Skip to content

Commit

Permalink
Leveraging op --cache option
Browse files Browse the repository at this point in the history
  • Loading branch information
dteare committed Mar 12, 2022
1 parent 6ad2010 commit 6ddebf5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub fn load_all_accounts(account_user_uuids: &Vec<String>) -> Result<Vec<Account

pub fn find_accounts(account_user_uuids: &Vec<String>) -> Result<Vec<AccountOverview>, Error> {
let output = Command::new("op")
.arg("--cache")
.arg("--format")
.arg("json")
.arg("account")
Expand Down Expand Up @@ -161,6 +162,7 @@ pub fn find_accounts(account_user_uuids: &Vec<String>) -> Result<Vec<AccountOver
// op --account BXRGOJ2Z5JB4RMA7FUYUURELUE --format json account get
pub fn get_account(user_id: &String) -> Result<AccountDetails, Error> {
let output = Command::new("op")
.arg("--cache")
.arg("--account")
.arg(user_id)
.arg("--format")
Expand All @@ -184,6 +186,7 @@ pub fn get_account(user_id: &String) -> Result<AccountDetails, Error> {
// op --format json --account A vault list | op --format json --account A vault get --format json -
pub fn load_all_vaults(account_id: &String) -> Result<Vec<VaultDetails>, Error> {
let output = Command::new("op")
.arg("--cache")
.arg("--format")
.arg("json")
.arg("--account")
Expand All @@ -202,6 +205,7 @@ pub fn load_all_vaults(account_id: &String) -> Result<Vec<VaultDetails>, Error>
}

let mut vault_details_cmd = Command::new("op")
.arg("--cache")
.arg("--format")
.arg("json")
.arg("--account")
Expand Down Expand Up @@ -254,6 +258,7 @@ pub fn load_all_vaults(account_id: &String) -> Result<Vec<VaultDetails>, Error>
#[allow(dead_code)]
pub fn find_vaults(account_id: &String) -> Result<Vec<VaultOverview>, Error> {
let output = Command::new("op")
.arg("--cache")
.arg("--format")
.arg("json")
.arg("--account")
Expand All @@ -278,6 +283,7 @@ pub fn find_vaults(account_id: &String) -> Result<Vec<VaultOverview>, Error> {
#[allow(dead_code)]
pub fn get_vault(account_id: &String, vault_id: &String) -> Result<VaultDetails, Error> {
let output = Command::new("op")
.arg("--cache")
.arg("--format")
.arg("json")
.arg("--account")
Expand All @@ -302,6 +308,7 @@ pub fn get_vault(account_id: &String, vault_id: &String) -> Result<VaultDetails,
// op --format json --account A --vault V item list | op --format json --account A --vault V item get --format json -
pub fn load_all_items(account_id: &String, vault_id: &String) -> Result<Vec<ItemDetails>, Error> {
let list_output = Command::new("op")
.arg("--cache")
.arg("--format")
.arg("json")
.arg("--account")
Expand All @@ -322,6 +329,7 @@ pub fn load_all_items(account_id: &String, vault_id: &String) -> Result<Vec<Item
}

let mut item_details_cmd = Command::new("op")
.arg("--cache")
.arg("--account")
.arg(account_id)
.arg("--vault")
Expand Down Expand Up @@ -376,6 +384,7 @@ pub fn load_all_items(account_id: &String, vault_id: &String) -> Result<Vec<Item
#[allow(dead_code)]
pub fn find_items(account_id: &String, vault_id: &String) -> Result<Vec<ItemOverview>, Error> {
let output = Command::new("op")
.arg("--cache")
.arg("--format")
.arg("json")
.arg("--account")
Expand Down Expand Up @@ -406,6 +415,7 @@ pub fn get_item(
item_id: &String,
) -> Result<ItemDetails, Error> {
let output = Command::new("op")
.arg("--cache")
.arg("--account")
.arg(account_id)
.arg("--vault")
Expand Down

0 comments on commit 6ddebf5

Please sign in to comment.