Skip to content

Commit 79c1998

Browse files
authored
fix-casing-in-cli-options (JabRef#11575)
* Fix casing in CLI options (and refine description) * Fix typo * Fix CHANGELOG.md
1 parent dc2e17a commit 79c1998

5 files changed

Lines changed: 27 additions & 27 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
2626
- 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)
2727
- JabRef does not show finished background tasks in the status bar popup. [#11574](https://github.com/JabRef/jabref/pull/11574)
2828
- We enhanced the indexing speed. [#11502](https://github.com/JabRef/jabref/pull/11502)
29+
- ⚠️ Renamed command line parameters `embeddBibfileInPdf` to `embedBibFileInPdf`, `writeMetadatatoPdf` to `writeMetadataToPdf`, and `writeXMPtoPdf` to `writeXmpToPdf`. [#11575](https://github.com/JabRef/jabref/pull/11575)
2930

3031
### Fixed
3132

src/main/java/org/jabref/cli/ArgumentProcessor.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,22 @@ public void processArguments() {
239239
automaticallySetFileLinks(loaded);
240240
}
241241

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

246-
if (cli.isWriteMetadatatoPdf() || cli.isWriteXMPtoPdf() || cli.isEmbeddBibfileInPdf()) {
246+
if (cli.isWriteMetadataToPdf() || cli.isWriteXmpToPdf() || cli.isEmbedBibFileInPdf()) {
247247
if (!loaded.isEmpty()) {
248248
writeMetadataToPdf(loaded,
249-
cli.getWriteMetadatatoPdf(),
249+
cli.getWriteMetadataToPdf(),
250250
preferencesService.getXmpPreferences(),
251251
preferencesService.getFilePreferences(),
252252
preferencesService.getLibraryPreferences().getDefaultBibDatabaseMode(),
253253
Injector.instantiateModelOrService(BibEntryTypesManager.class),
254254
preferencesService.getFieldPreferences(),
255255
Injector.instantiateModelOrService(JournalAbbreviationRepository.class),
256-
cli.isWriteXMPtoPdf() || cli.isWriteMetadatatoPdf(),
257-
cli.isEmbeddBibfileInPdf() || cli.isWriteMetadatatoPdf());
256+
cli.isWriteXmpToPdf() || cli.isWriteMetadataToPdf(),
257+
cli.isEmbedBibFileInPdf() || cli.isWriteMetadataToPdf());
258258
}
259259
}
260260

@@ -379,7 +379,7 @@ private void writeMetadataToPDFsOfEntry(BibDatabaseContext databaseContext,
379379
if (embeddedBibFilePdfExporter.exportToAllFilesOfEntry(databaseContext, filePreferences, entry, List.of(entry), abbreviationRepository)) {
380380
System.out.printf("Successfully embedded metadata on at least one linked file of %s%n", citeKey);
381381
} else {
382-
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);
382+
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);
383383
}
384384
}
385385
} catch (Exception e) {

src/main/java/org/jabref/cli/JabRefCLI.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public class JabRefCLI {
3333

3434
public JabRefCLI(String[] args) throws ParseException {
3535
Options options = getOptions();
36-
3736
this.cl = new DefaultParser().parse(options, args, true);
3837
this.leftOver = cl.getArgList();
3938
}
@@ -153,21 +152,21 @@ public boolean isAutomaticallySetFileLinks() {
153152
return cl.hasOption("automaticallySetFileLinks");
154153
}
155154

156-
public boolean isWriteXMPtoPdf() {
157-
return cl.hasOption("writeXMPtoPdf");
155+
public boolean isWriteXmpToPdf() {
156+
return cl.hasOption("writeXmpToPdf");
158157
}
159158

160-
public boolean isEmbeddBibfileInPdf() {
161-
return cl.hasOption("embeddBibfileInPdf");
159+
public boolean isEmbedBibFileInPdf() {
160+
return cl.hasOption("embedBibFileInPdf");
162161
}
163162

164-
public boolean isWriteMetadatatoPdf() {
165-
return cl.hasOption("writeMetadatatoPdf");
163+
public boolean isWriteMetadataToPdf() {
164+
return cl.hasOption("writeMetadataToPdf");
166165
}
167166

168-
public String getWriteMetadatatoPdf() {
169-
return cl.hasOption("writeMetadatatoPdf") ? cl.getOptionValue("writeMetadatatoPdf") :
170-
cl.hasOption("writeXMPtoPdf") ? cl.getOptionValue("writeXMPtoPdf") :
167+
public String getWriteMetadataToPdf() {
168+
return cl.hasOption("writeMetadatatoPdf") ? cl.getOptionValue("writeMetadataToPdf") :
169+
cl.hasOption("writeXMPtoPdf") ? cl.getOptionValue("writeXmpToPdf") :
171170
cl.hasOption("embeddBibfileInPdf") ? cl.getOptionValue("embeddBibfileInPdf") : null;
172171
}
173172

@@ -273,24 +272,24 @@ private static Options getOptions() {
273272

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

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

290289
options.addOption(Option
291290
.builder("w")
292-
.longOpt("writeMetadatatoPdf")
293-
.desc("%s: '%s'".formatted(Localization.lang("Write BibTeXEntry as metadata to PDF."), "-w pathToMyOwnPaper.pdf"))
291+
.longOpt("writeMetadataToPdf")
292+
.desc("%s: '%s'".formatted(Localization.lang("Write BibTeX to PDF (XMP and embedded)"), "-w pathToMyOwnPaper.pdf"))
294293
.hasArg()
295294
.argName("CITEKEY1[,CITEKEY2][,CITEKEYn] | PDF1[,PDF2][,PDFn] | all")
296295
.build());

src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private Node createFileDisplay(LinkedFileViewModel linkedFile) {
217217
acceptAutoLinkedFile.getStyleClass().setAll("icon-button");
218218

219219
Button writeMetadataToPdf = IconTheme.JabRefIcons.PDF_METADATA_WRITE.asButton();
220-
writeMetadataToPdf.setTooltip(new Tooltip(Localization.lang("Write BibTeXEntry metadata to PDF.")));
220+
writeMetadataToPdf.setTooltip(new Tooltip(Localization.lang("Write BibTeX to PDF (XMP and embedded)")));
221221
writeMetadataToPdf.visibleProperty().bind(linkedFile.isOfflinePdfProperty());
222222
writeMetadataToPdf.getStyleClass().setAll("icon-button");
223223
WriteMetadataToSinglePdfAction writeMetadataToSinglePdfAction = new WriteMetadataToSinglePdfAction(

src/main/resources/l10n/JabRef_en.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -959,16 +959,16 @@ Whatever\ option\ you\ choose,\ Mr.\ DLib\ may\ share\ its\ data\ with\ research
959959

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

962-
Write\ BibTeXEntry\ as\ metadata\ to\ PDF.=Write BibTeXEntry as metadata to PDF.
963962
Write\ metadata\ for\ all\ PDFs\ in\ current\ library?=Write metadata for all PDFs in current library?
964963
Writing\ metadata...=Writing metadata...
965964

966965
Embed\ BibTeX\ as\ attached\ file\ in\ PDF.=Embed BibTeX as attached file in PDF.
967-
File\ '%0'\ is\ write\ protected.=File '%0' is write protected.
968-
Write\ BibTeXEntry\ as\ XMP\ metadata\ to\ PDF.=Write BibTeXEntry as XMP metadata to PDF.
969-
Write\ BibTeXEntry\ metadata\ to\ PDF.=Write BibTeXEntry metadata to PDF.
966+
Write\ BibTeX\ as\ XMP\ metadata\ to\ PDF.=Write BibTeX as XMP metadata to PDF.
967+
Write\ BibTeX\ to\ PDF\ (XMP\ and\ embedded)=Write BibTeX to PDF (XMP and embedded)
970968
Write\ metadata\ to\ PDF\ files=Write metadata to PDF files
971969

970+
File\ '%0'\ is\ write\ protected.=File '%0' is write protected.
971+
972972
XMP-annotated\ PDF=XMP-annotated PDF
973973
XMP\ export\ privacy\ settings=XMP export privacy settings
974974
XMP\ metadata=XMP metadata

0 commit comments

Comments
 (0)