Skip to content

Commit

Permalink
allow specifying file via f option
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkolson committed Mar 24, 2023
1 parent e35a527 commit a0bffb3
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.quarkus.runtime.QuarkusApplication;
import io.quarkus.runtime.annotations.QuarkusMain;
import picocli.CommandLine;
import picocli.CommandLine.Option;
import picocli.CommandLine.Command;

import javax.enterprise.context.control.ActivateRequestContext;
Expand All @@ -25,9 +26,9 @@
@Command
@SuppressWarnings("unused")
public class LiberateCommand implements Runnable, QuarkusApplication {
@Option(names = {"-f", "--file"}, description = "Path to Apple Notes sqlite file")
private String filePath;
private final CommandLine.IFactory factory;


private final AgroalDataSource dataSource;

public LiberateCommand(CommandLine.IFactory factory, AgroalDataSource dataSource) {
Expand Down Expand Up @@ -60,10 +61,13 @@ public int run(String... args) {
}

private void copyNotesDb() {
// TODO allow specifying path to file
var noteStoreDb = new File(Constants.NOTE_STORE_PATH);
if (this.filePath == null) {
this.filePath = Constants.NOTE_STORE_PATH;
}
var noteStoreDb = new File(filePath);

if (!noteStoreDb.exists()) {
// TODO modify message here
throw new RuntimeException(UserMessages.CANT_AUTOMATICALLY_FIND_NOTES_DATABASE);
}

Expand Down

0 comments on commit a0bffb3

Please sign in to comment.