Skip to content

Commit

Permalink
Moved the import/export block after the checkblock.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarkowsky committed Sep 12, 2023
1 parent ab22fba commit ad90396
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Source/santactl/Commands/SNTCommandRule.m
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,6 @@ - (void)runWithArguments:(NSArray *)arguments {
}
}

if (jsonFilePath != nil && ![jsonFilePath isEqualToString:@""]) {
if (importRules) {
[self importJSONFile:jsonFilePath];
} else if (exportRules) {
[self exportJSONFile:jsonFilePath];
}
return;
}

if (path) {
SNTFileInfo *fi = [[SNTFileInfo alloc] initWithPath:path];
if (!fi.path) {
Expand Down Expand Up @@ -245,6 +236,16 @@ - (void)runWithArguments:(NSArray *)arguments {
return [self printStateOfRule:newRule daemonConnection:self.daemonConn];
}

// Note this block needs to come after the check block above.
if (jsonFilePath.length > 0) {
if (importRules) {
[self importJSONFile:jsonFilePath];
} else if (exportRules) {
[self exportJSONFile:jsonFilePath];
}
return;
}

if (newRule.state == SNTRuleStateUnknown) {
[self printErrorUsageAndExit:@"No state specified"];
} else if (!newRule.identifier) {
Expand Down

0 comments on commit ad90396

Please sign in to comment.