pub struct PassStore { /* private fields */ }Expand description
Represents the underlying directory structure of a password store. The folder structure is inherit from pass(1).
Implementations§
Source§impl PassStore
Represents the underlying directory structure of a password store.
The folder structure is inherit from pass(1).
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.
Sourcepub fn from(path: &PathBuf) -> Result<PassStore>
pub 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);
Sourcepub fn set_verbose(&mut self, verbose: bool)
pub fn set_verbose(&mut self, verbose: bool)
Set the verbose printouts for the store.
Sourcepub fn absolute_path(&self, entry: &str) -> PathBuf
pub fn absolute_path(&self, entry: &str) -> PathBuf
Returns the absolute_path of a given PassEntry.
Sourcepub fn get_location(&self) -> String
pub fn get_location(&self) -> String
Returns the location of the PassStore as String.
Sourcepub fn find<S>(&self, query: S) -> Vec<PassTreePath>
pub fn find<S>(&self, query: S) -> Vec<PassTreePath>
Find and returns a Vector of PassEntrys by its name.
Sourcepub fn get<S>(&self, pass: S) -> Option<PassTreePath>
pub fn get<S>(&self, pass: S) -> Option<PassTreePath>
Get a PassTreePath from the give parameter pass. Returns an
Sourcepub fn read(&self, entry: &PassTreePath) -> Option<String>
pub 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.
Sourcepub fn insert<VCS, D>(&mut self, vcs: VCS, entry: &str, data: D) -> Result<()>
pub fn insert<VCS, D>(&mut self, vcs: VCS, entry: &str, data: D) -> Result<()>
Inserts a new entry into the store. This creates a new encrypted
gpg-file and add it to version control system, provided via vcs.
Sourcepub fn remove<VCS>(&mut self, vcs: VCS, entry: &PassTreePath) -> Result<()>where
VCS: VersionControl,
pub 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.
Sourcepub fn entries<'a>(&'a self) -> &'a PassTree
pub fn entries<'a>(&'a self) -> &'a PassTree
Gets all entries from the store as a Tree structure.
Sourcepub fn print_tree(&self, path: &PassTreePath)
pub 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!
Sourcepub fn grep(&self, searcher: &str, grep_args: &Vec<&str>) -> Result<String>
pub 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.