From d74bdbcfd0d6b10dd698abd27034b81f5b5acc61 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Dec 2020 22:07:17 +0100 Subject: [PATCH] [libcalamares] coding-style, logging in calautomount --- src/libcalamares/partition/calautomount.cpp | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/libcalamares/partition/calautomount.cpp b/src/libcalamares/partition/calautomount.cpp index 3eb95be08..a91fc3dda 100644 --- a/src/libcalamares/partition/calautomount.cpp +++ b/src/libcalamares/partition/calautomount.cpp @@ -18,31 +18,35 @@ */ static const char usage[] = "Usage: calautomount <-e|-d>\n" -"\n" -"Enables (if `-e` is passed as command-line option) or\n" -"Disables (if `-d` is passed as command-line option)\n" -"\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" -"passed on the command-line.\n\n"; + "\n" + "Enables (if `-e` is passed as command-line option) or\n" + "Disables (if `-d` is passed as command-line option)\n" + "\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" + "passed on the command-line.\n\n"; #include "AutoMount.h" #include "Sync.h" +#include "utils/Logger.h" #include #include -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; return 1; } - CalamaresUtils::Partition::automountDisable( argv[1][1] == 'd'); + Logger::setupLogfile(); + Logger::setupLogLevel( Logger::LOGDEBUG ); + CalamaresUtils::Partition::automountDisable( argv[ 1 ][ 1 ] == 'd' ); return 0; }