Adding --quiet option to the CLI. (#2507)

This commit is contained in:
louib
2018-11-28 11:24:12 -05:00
committed by Jonathan White
parent 4e49de1afb
commit fff0f11b33
21 changed files with 252 additions and 44 deletions

View File

@@ -43,6 +43,16 @@ FILE* STDERR = stderr;
*/
FILE* STDIN = stdin;
/**
* DEVNULL file handle for the CLI.
*/
#ifdef Q_OS_WIN
FILE* DEVNULL = fopen("nul", "w");
#else
FILE* DEVNULL = fopen("/dev/null", "w");
#endif
void setStdinEcho(bool enable = true)
{
#ifdef Q_OS_WIN
@@ -95,9 +105,9 @@ void setNextPassword(const QString& password)
*
* @return the password
*/
QString getPassword()
QString getPassword(FILE* outputDescriptor)
{
TextStream out(STDOUT, QIODevice::WriteOnly);
TextStream out(outputDescriptor, QIODevice::WriteOnly);
// return preset password if one is set
if (!Test::nextPasswords.isEmpty()) {