10#include <QRegularExpression>
41 dbg() <<
"Git pull failed with code:" << result;
66 executePass(
PASS_SHOW, {
"show", file},
"",
true);
81 QStringList args = {
"insert",
"-m"};
93 executePass(
PASS_REMOVE, {
"rm", (isDir ?
"-rf" :
"-f"), file});
106 QString dirWithoutPassdir =
108 QStringList args = {
"init",
"--path=" + dirWithoutPassdir};
109 foreach (
const UserInfo &user, users) {
124 QFileInfo srcFileInfo = QFileInfo(src);
125 QFileInfo destFileInfo = QFileInfo(dest);
130 if (!force && srcFileInfo.isFile() && destFileInfo.isFile()) {
135 .relativeFilePath(QDir(src).absolutePath());
137 .relativeFilePath(QDir(dest).absolutePath());
140 if (srcFileInfo.isFile() && srcFileInfo.suffix() ==
"gpg") {
143 if (destFileInfo.isFile() && destFileInfo.suffix() ==
"gpg") {
164 QFileInfo srcFileInfo = QFileInfo(src);
165 QFileInfo destFileInfo = QFileInfo(dest);
169 if (!force && srcFileInfo.isFile() && destFileInfo.isFile()) {
174 .relativeFilePath(QDir(src).absolutePath());
176 .relativeFilePath(QDir(dest).absolutePath());
179 if (srcFileInfo.isFile() && srcFileInfo.suffix() ==
"gpg") {
182 if (destFileInfo.isFile() && destFileInfo.suffix() ==
"gpg") {
201 QStringList args = {
"grep"};
204 args <<
"--" << pattern;
205 executePass(
PASS_GREP, args, QString(),
true);
216void RealPass::executePass(
PROCESS id,
const QStringList &args, QString input,
217 bool readStdout,
bool readStderr) {
219 std::move(input), readStdout, readStderr);
static auto executeBlocking(const QString &app, const QStringList &args, const QString &input=QString(), QString *process_out=nullptr, QString *process_err=nullptr) -> int
Executor::executeBlocking blocking version of the executor, takes input and presents it as stdin.
void executeWrapper(PROCESS id, const QString &app, const QStringList &args, bool readStdout=true, bool readStderr=true)
Execute external wrapper command.
static auto getPassStore(const QString &defaultValue=QVariant().toString()) -> QString
Get password store directory path.
static auto getPassExecutable(const QString &defaultValue=QVariant().toString()) -> QString
Get pass executable path.
void Init(QString path, const QList< UserInfo > &users) override
Initialize password store.
void OtpGenerate(QString file) override
Generate OTP code.
void Insert(QString file, QString newValue, bool overwrite=false) override
Insert new password.
void Show(QString file) override
Show decrypted password.
void Copy(const QString src, const QString dest, const bool force=false) override
Copy password file or directory.
void GitPull_b() override
Pull with rebase.
RealPass()
Construct a RealPass instance.
void Remove(QString file, bool isDir=false) override
Remove password or directory.
void GitInit() override
Initialize Git repository in password store.
void GitPull() override
Pull changes from remote.
void Move(const QString src, const QString dest, const bool force=false) override
Move password file or directory.
void Grep(QString pattern, bool caseInsensitive=false) override
Search password content via 'pass grep'.
void GitPush() override
Push changes to remote.
static auto endsWithGpg() -> const QRegularExpression &
Returns a regex to match .gpg file extensions.
Debug utilities for QtPass.
#define dbg()
Simple debug macro that includes file and line number.
PROCESS
Identifies different subprocess operations used in QtPass.
Stores key info lines including validity, creation date and more.
bool enabled
UserInfo::enabled Whether this user/key is enabled for normal use. True when the key should be treate...
QString key_id
UserInfo::key_id hexadecimal representation of the GnuPG key identifier.