Feature/14361 enable parameters for cli
Closes #14361
This draft PR starts adding CLI support for citation key customization. Work in progress. I will continue adding the remaining options step-by-step.
Currently, I added the first option: --pattern: override default citation key pattern (e.g., [auth][year]). Not fully optimized yet. More CLI options from CitationKeyPatternPreferences will be added next.
Steps to test
:jabkit:run --args="citationkeys generate --input=C:\git-repositories\jabref\jablib\src\main\resources\Chocolate.bib --pattern='[auth][year]'"
No GUI settings are modified — this only affects the current CLI run
Mandatory checks
- [x] I own the copyright of the code submitted and I license it under the MIT license
- [x] I manually tested my changes in running JabRef (always required)
- [ ] I added JUnit tests for changes (if applicable)
- [ ] I added screenshots in the PR description (if change is visible to the user)
- [ ] I described the change in
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user) - [ ] I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.
@koppor @calixtus Fixed all review comments as suggested - removed CitationKeyCommands description, deleted test.bib, and resolved README changes.
Not fully optimized yet.
Please work on this. See the screenshot at https://github.com/JabRef/jabref/issues/14361.
@calixtus @koppor Hi! I’ve implemented all parameters of CitationKeyPatternPreferences in the CLI except the per-entry-type patterns.
CitationKeyPatternPreferences supports type-specific patterns , but JabKit’s GlobalCitationKeyPatterns currently applies only a single default pattern and does not support per-entry-type overrides.
public class GlobalCitationKeyPatterns extends AbstractCitationKeyPatterns {
public GlobalCitationKeyPatterns(CitationKeyPattern defaultPattern) {
this.defaultPattern = defaultPattern;
}
public static GlobalCitationKeyPatterns fromPattern(String pattern) {
return new GlobalCitationKeyPatterns(new CitationKeyPattern(pattern));
}
@Override
public CitationKeyPattern getLastLevelCitationKeyPattern(EntryType entryType) {
return defaultPattern;
}
Because of this mismatch, I’ve kept keyPatterns unchanged for now until your guidance.
Thanks!
I wonder why there is not any banner displayed?
I wonder why there is not any banner displayed?
Hi @calixtus I’m not fully sure what you mean by the missing banner here. Do you expect the standard JabKit startup banner to be shown for citationkeys generate, or some explicit output indicating that the command is running/completed? Just want to confirm before implementing. Thanks!