Skip to content

Commit

Permalink
Fix regression of --display-config use (#3035)
Browse files Browse the repository at this point in the history
* Fix regression of --display-config use after fast failing if --sync or --monitor has not been used
  • Loading branch information
abraunegg authored Dec 7, 2024
1 parent eade671 commit 3937751
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 3937751

Please sign in to comment.