Skip to content

Commit

Permalink
fix-casing-in-cli-options (#11575)
Browse files Browse the repository at this point in the history
* Fix casing in CLI options (and refine description)

* Fix typo

* Fix CHANGELOG.md
  • Loading branch information
koppor authored Aug 4, 2024
1 parent dc2e17a commit 79c1998
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- JabRef respects the [configuration for storing files relative to the .bib file](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#directories-for-files) in more cases. [#11492](https://github.com/JabRef/jabref/pull/11492)
- JabRef does not show finished background tasks in the status bar popup. [#11574](https://github.com/JabRef/jabref/pull/11574)
- We enhanced the indexing speed. [#11502](https://github.com/JabRef/jabref/pull/11502)
- ⚠️ Renamed command line parameters `embeddBibfileInPdf` to `embedBibFileInPdf`, `writeMetadatatoPdf` to `writeMetadataToPdf`, and `writeXMPtoPdf` to `writeXmpToPdf`. [#11575](https://github.com/JabRef/jabref/pull/11575)

### Fixed

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,22 +239,22 @@ public void processArguments() {
automaticallySetFileLinks(loaded);
}

if ((cli.isWriteXMPtoPdf() && cli.isEmbeddBibfileInPdf()) || (cli.isWriteMetadatatoPdf() && (cli.isWriteXMPtoPdf() || cli.isEmbeddBibfileInPdf()))) {
System.err.println("Give only one of [writeXMPtoPdf, embeddBibfileInPdf, writeMetadatatoPdf]");
if ((cli.isWriteXmpToPdf() && cli.isEmbedBibFileInPdf()) || (cli.isWriteMetadataToPdf() && (cli.isWriteXmpToPdf() || cli.isEmbedBibFileInPdf()))) {
System.err.println("Give only one of [writeXmpToPdf, embedBibFileInPdf, writeMetadataToPdf]");
}

if (cli.isWriteMetadatatoPdf() || cli.isWriteXMPtoPdf() || cli.isEmbeddBibfileInPdf()) {
if (cli.isWriteMetadataToPdf() || cli.isWriteXmpToPdf() || cli.isEmbedBibFileInPdf()) {
if (!loaded.isEmpty()) {
writeMetadataToPdf(loaded,
cli.getWriteMetadatatoPdf(),
cli.getWriteMetadataToPdf(),
preferencesService.getXmpPreferences(),
preferencesService.getFilePreferences(),
preferencesService.getLibraryPreferences().getDefaultBibDatabaseMode(),
Injector.instantiateModelOrService(BibEntryTypesManager.class),
preferencesService.getFieldPreferences(),
Injector.instantiateModelOrService(JournalAbbreviationRepository.class),
cli.isWriteXMPtoPdf() || cli.isWriteMetadatatoPdf(),
cli.isEmbeddBibfileInPdf() || cli.isWriteMetadatatoPdf());
cli.isWriteXmpToPdf() || cli.isWriteMetadataToPdf(),
cli.isEmbedBibFileInPdf() || cli.isWriteMetadataToPdf());
}
}

Expand Down Expand Up @@ -379,7 +379,7 @@ private void writeMetadataToPDFsOfEntry(BibDatabaseContext databaseContext,
if (embeddedBibFilePdfExporter.exportToAllFilesOfEntry(databaseContext, filePreferences, entry, List.of(entry), abbreviationRepository)) {
System.out.printf("Successfully embedded metadata on at least one linked file of %s%n", citeKey);
} else {
System.out.printf("Cannot embedd metadata on any linked files of %s. Make sure there is at least one linked file and the path is correct.%n", citeKey);
System.out.printf("Cannot embed metadata on any linked files of %s. Make sure there is at least one linked file and the path is correct.%n", citeKey);
}
}
} catch (Exception e) {
Expand Down
29 changes: 14 additions & 15 deletions src/main/java/org/jabref/cli/JabRefCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class JabRefCLI {

public JabRefCLI(String[] args) throws ParseException {
Options options = getOptions();

this.cl = new DefaultParser().parse(options, args, true);
this.leftOver = cl.getArgList();
}
Expand Down Expand Up @@ -153,21 +152,21 @@ public boolean isAutomaticallySetFileLinks() {
return cl.hasOption("automaticallySetFileLinks");
}

public boolean isWriteXMPtoPdf() {
return cl.hasOption("writeXMPtoPdf");
public boolean isWriteXmpToPdf() {
return cl.hasOption("writeXmpToPdf");
}

public boolean isEmbeddBibfileInPdf() {
return cl.hasOption("embeddBibfileInPdf");
public boolean isEmbedBibFileInPdf() {
return cl.hasOption("embedBibFileInPdf");
}

public boolean isWriteMetadatatoPdf() {
return cl.hasOption("writeMetadatatoPdf");
public boolean isWriteMetadataToPdf() {
return cl.hasOption("writeMetadataToPdf");
}

public String getWriteMetadatatoPdf() {
return cl.hasOption("writeMetadatatoPdf") ? cl.getOptionValue("writeMetadatatoPdf") :
cl.hasOption("writeXMPtoPdf") ? cl.getOptionValue("writeXMPtoPdf") :
public String getWriteMetadataToPdf() {
return cl.hasOption("writeMetadatatoPdf") ? cl.getOptionValue("writeMetadataToPdf") :
cl.hasOption("writeXMPtoPdf") ? cl.getOptionValue("writeXmpToPdf") :
cl.hasOption("embeddBibfileInPdf") ? cl.getOptionValue("embeddBibfileInPdf") : null;
}

Expand Down Expand Up @@ -273,24 +272,24 @@ private static Options getOptions() {

options.addOption(Option
.builder()
.longOpt("writeXMPtoPdf")
.desc("%s: '%s'".formatted(Localization.lang("Write BibTeXEntry as XMP metadata to PDF."), "-w pathToMyOwnPaper.pdf"))
.longOpt("writeXmpToPdf")
.desc("%s: '%s'".formatted(Localization.lang("Write BibTeX as XMP metadata to PDF."), "-w pathToMyOwnPaper.pdf"))
.hasArg()
.argName("CITEKEY1[,CITEKEY2][,CITEKEYn] | PDF1[,PDF2][,PDFn] | all")
.build());

options.addOption(Option
.builder()
.longOpt("embeddBibfileInPdf")
.longOpt("embedBibFileInPdf")
.desc("%s: '%s'".formatted(Localization.lang("Embed BibTeX as attached file in PDF."), "-w pathToMyOwnPaper.pdf"))
.hasArg()
.argName("CITEKEY1[,CITEKEY2][,CITEKEYn] | PDF1[,PDF2][,PDFn] | all")
.build());

options.addOption(Option
.builder("w")
.longOpt("writeMetadatatoPdf")
.desc("%s: '%s'".formatted(Localization.lang("Write BibTeXEntry as metadata to PDF."), "-w pathToMyOwnPaper.pdf"))
.longOpt("writeMetadataToPdf")
.desc("%s: '%s'".formatted(Localization.lang("Write BibTeX to PDF (XMP and embedded)"), "-w pathToMyOwnPaper.pdf"))
.hasArg()
.argName("CITEKEY1[,CITEKEY2][,CITEKEYn] | PDF1[,PDF2][,PDFn] | all")
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private Node createFileDisplay(LinkedFileViewModel linkedFile) {
acceptAutoLinkedFile.getStyleClass().setAll("icon-button");

Button writeMetadataToPdf = IconTheme.JabRefIcons.PDF_METADATA_WRITE.asButton();
writeMetadataToPdf.setTooltip(new Tooltip(Localization.lang("Write BibTeXEntry metadata to PDF.")));
writeMetadataToPdf.setTooltip(new Tooltip(Localization.lang("Write BibTeX to PDF (XMP and embedded)")));
writeMetadataToPdf.visibleProperty().bind(linkedFile.isOfflinePdfProperty());
writeMetadataToPdf.getStyleClass().setAll("icon-button");
WriteMetadataToSinglePdfAction writeMetadataToSinglePdfAction = new WriteMetadataToSinglePdfAction(
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -959,16 +959,16 @@ Whatever\ option\ you\ choose,\ Mr.\ DLib\ may\ share\ its\ data\ with\ research

Will\ write\ metadata\ to\ the\ PDFs\ linked\ from\ selected\ entries.=Will write metadata to the PDFs linked from selected entries.

Write\ BibTeXEntry\ as\ metadata\ to\ PDF.=Write BibTeXEntry as metadata to PDF.
Write\ metadata\ for\ all\ PDFs\ in\ current\ library?=Write metadata for all PDFs in current library?
Writing\ metadata...=Writing metadata...

Embed\ BibTeX\ as\ attached\ file\ in\ PDF.=Embed BibTeX as attached file in PDF.
File\ '%0'\ is\ write\ protected.=File '%0' is write protected.
Write\ BibTeXEntry\ as\ XMP\ metadata\ to\ PDF.=Write BibTeXEntry as XMP metadata to PDF.
Write\ BibTeXEntry\ metadata\ to\ PDF.=Write BibTeXEntry metadata to PDF.
Write\ BibTeX\ as\ XMP\ metadata\ to\ PDF.=Write BibTeX as XMP metadata to PDF.
Write\ BibTeX\ to\ PDF\ (XMP\ and\ embedded)=Write BibTeX to PDF (XMP and embedded)
Write\ metadata\ to\ PDF\ files=Write metadata to PDF files

File\ '%0'\ is\ write\ protected.=File '%0' is write protected.

XMP-annotated\ PDF=XMP-annotated PDF
XMP\ export\ privacy\ settings=XMP export privacy settings
XMP\ metadata=XMP metadata
Expand Down

0 comments on commit 79c1998

Please sign in to comment.