[libcalamares] coding-style, logging in calautomount

main
Adriaan de Groot 4 years ago
parent 3150785ff1
commit d74bdbcfd0

@ -18,31 +18,35 @@
*/ */
static const char usage[] = "Usage: calautomount <-e|-d>\n" static const char usage[] = "Usage: calautomount <-e|-d>\n"
"\n" "\n"
"Enables (if `-e` is passed as command-line option) or\n" "Enables (if `-e` is passed as command-line option) or\n"
"Disables (if `-d` is passed as command-line option)\n" "Disables (if `-d` is passed as command-line option)\n"
"\n" "\n"
"automounting of disks in the host system as best it can.\n" "automounting of disks in the host system as best it can.\n"
"Exits with code 0 on success or 1 if an unknown option is\n" "Exits with code 0 on success or 1 if an unknown option is\n"
"passed on the command-line.\n\n"; "passed on the command-line.\n\n";
#include "AutoMount.h" #include "AutoMount.h"
#include "Sync.h" #include "Sync.h"
#include "utils/Logger.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
int main(int argc, char **argv) int
main( int argc, char** argv )
{ {
QCoreApplication app(argc, argv); QCoreApplication app( argc, argv );
if ((argc != 2) || (argv[1][0] != '-') || (argv[1][1] !='e' && argv[1][1] !='d')) if ( ( argc != 2 ) || ( argv[ 1 ][ 0 ] != '-' ) || ( argv[ 1 ][ 1 ] != 'e' && argv[ 1 ][ 1 ] != 'd' ) )
{ {
qWarning() << usage; qWarning() << usage;
return 1; return 1;
} }
CalamaresUtils::Partition::automountDisable( argv[1][1] == 'd'); Logger::setupLogfile();
Logger::setupLogLevel( Logger::LOGDEBUG );
CalamaresUtils::Partition::automountDisable( argv[ 1 ][ 1 ] == 'd' );
return 0; return 0;
} }

Loading…
Cancel
Save