From 39377515a69a3fc0f145d191503752a6fbaa12dd Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sat, 7 Dec 2024 17:42:29 +1100 Subject: [PATCH] Fix regression of --display-config use (#3035) * Fix regression of --display-config use after fast failing if --sync or --monitor has not been used --- src/main.d | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main.d b/src/main.d index 19278d632..ebbae39fb 100644 --- a/src/main.d +++ b/src/main.d @@ -203,15 +203,19 @@ int main(string[] cliArgs) { // Are we performing some sort of 'no-sync' operation task? noSyncTaskOperationRequested = appConfig.hasNoSyncOperationBeenRequested(); // returns true if we are - // If 'syncOrMonitorMissing' is true and 'noSyncTaskOperationRequested' is false (meaning we are not doing some 'no-sync' operation like '--display-sync-status' or '--get-sharepoint-drive-id' + // If 'syncOrMonitorMissing' is true and 'noSyncTaskOperationRequested' is false (meaning we are not doing some 'no-sync' operation like '--display-sync-status', '--get-sharepoint-drive-id' or '--display-config' // - fail fast here to avoid setting up all the other components, database, initialising the API as this is all pointless if we just fail out later - if (syncOrMonitorMissing && !noSyncTaskOperationRequested) { - // Before failing fast, has the client been authenticated and does the 'refresh_token' contain data - if (exists(appConfig.refreshTokenFilePath) && getSize(appConfig.refreshTokenFilePath) > 0) { - // fail fast - print error message that --sync or --monitor are missing - printMissingOperationalSwitchesError(); - // Use exit scopes to shutdown API - return EXIT_FAILURE; + + // If we are not using --display-config, perform this check + if (!appConfig.getValueBool("display_config")) { + if (syncOrMonitorMissing && !noSyncTaskOperationRequested) { + // Before failing fast, has the client been authenticated and does the 'refresh_token' contain data + if (exists(appConfig.refreshTokenFilePath) && getSize(appConfig.refreshTokenFilePath) > 0) { + // fail fast - print error message that --sync or --monitor are missing + printMissingOperationalSwitchesError(); + // Use exit scopes to shutdown API + return EXIT_FAILURE; + } } }