Struct rasslib::store::PassStore
[−]
[src]
pub struct PassStore {
// some fields omitted
}Represents the underlying directory structure of a password store. The folder structure is inherit from pass(1).
Methods
impl PassStore
Represents the underlying directory structure of a password store. The folder structure is inherit from pass(1).
On construction of the store, base directory is be walked. All found
gpg-files will be treated as store entries, which are represented by
PassEntry.
fn new() -> Result<PassStore>
Constructs a new PassStore with the default store location.
fn from(path: &PathBuf) -> Result<PassStore>
Constructs a new PassStore using the provided location.
Examples
use std::path::PathBuf; use rasslib::store::PassStore; let p = PathBuf::from("/home/bar/.store"); let store = PassStore::from(&p);
fn set_verbose(&mut self, verbose: bool)
Set the verbose printouts for the store.
fn absolute_path(&self, entry: &str) -> PathBuf
Returns the absolute_path of a given PassEntry.
fn get_location(&self) -> String
Returns the location of the PassStore as String.
fn find<S>(&self, query: S) -> Vec<PassTreePath> where S: Into<String>
Find and returns a Vector of PassEntrys by its name.
fn get<S>(&self, pass: S) -> Option<PassTreePath> where S: Into<String>
Get a PassTreePath from the give parameter pass. Returns an
fn read(&self, entry: &PassTreePath) -> Option<String>
Reads and returns the content of the given PassEntry. The for the
gpg-file related to the PassEntry encrypt.
fn insert<VCS, D>(&mut self, vcs: VCS, entry: &str, data: D) -> Result<()> where D: Into<Vec<u8>>, VCS: VersionControl
Inserts a new entry into the store. This creates a new encrypted
gpg-file and add it to version control system, provided via vcs.
fn remove<VCS>(&mut self, vcs: VCS, entry: &PassTreePath) -> Result<()> where VCS: VersionControl
Removes a given PassEntry from the store. Therefore the related
gpg-file will be removed from the file-system and the internal entry
list. Further the vcs will use to commit that change.
Note that the entry passed into the function shall be a copy of the
original reference.
fn entries<'a>(&'a self) -> &'a PassTree
Gets all entries from the store as a Tree structure.
fn print_tree(&self, path: &PassTreePath)
Prints a give path as a tree. Note, if the path does not point
to any entry in the store, nothing will be printed!
fn grep(&self, searcher: &str, grep_args: &Vec<&str>) -> Result<String>
Executes over all entries in the store with the given search parameters.
Take note that grep_args can include all grep parameters which are
relevant for a piped grep execution. However, the last parameter shall
always be the grep command.