Skip to content

Commit 49cb131

Browse files
committed
Rename new option to --filter-fields-by-entrytype (#13)
1 parent cea7125 commit 49cb131

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Version 1.3.2 - 2024-04-12
44

5-
- Add `-b / --by-entrytype` option (issue #13).
5+
- Add `-b --filter-fields-by-entrytype` option (issue [#13](https://github.com/dlesbre/bibtex-autocomplete/issues/13)).
66
- Fix `-c / -C` flags only filtering queries and not results since 1.3.0
77
- Fix output of some error messages not displaying entry ID
88

@@ -14,7 +14,7 @@
1414
progress bar (hoping to make this even prettier once
1515
https://github.com/rsalmei/alive-progress/issues/188 gets resolved)
1616
- display source list on a new line in final output
17-
- Fix a new error occurring when checking DOIs (issue #12)
17+
- Fix a new error occurring when checking DOIs (issue [#12](https://github.com/dlesbre/bibtex-autocomplete/issues/12))
1818
- Officially support python 3.12
1919
- Build system change: now using `pyproject.toml` instead of `setup.py` and
2020
[ruff](https://github.com/astral-sh/ruff) instead of black, isort and flake8.
@@ -46,7 +46,7 @@
4646
- Fix author names with `von` prefix not formatted correctly
4747
- Fix author names with capitalized prefix (`De`, `Von`, ...) not formatted correctly
4848
- Fix `btac` removing capital-preserving brackets and converting to unicode in
49-
user supplied fields (issue #11).
49+
user supplied fields (issue [#11](https://github.com/dlesbre/bibtex-autocomplete/issues/11)).
5050

5151
## Version 1.2.2 - 2023-11-26
5252

@@ -72,11 +72,11 @@
7272
## Version 1.1.8 - 2023-02-27
7373

7474
- Add global exception catches to resume work if a single lookup fails
75-
- Fix websites returning invalid URLs leading to errors (issue #8, part 2)
75+
- Fix websites returning invalid URLs leading to errors (issue [#8](https://github.com/dlesbre/bibtex-autocomplete/issues/8), part 2)
7676

7777
## Version 1.1.7 - 2023-02-27
7878

79-
- Fix trying to decode non-text doi response (issue #8)
79+
- Fix trying to decode non-text doi response (issue [#8](https://github.com/dlesbre/bibtex-autocomplete/issues/8))
8080
- Add entry name to error/warning messages
8181

8282
## Version 1.1.6 - 2023-01-06

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,21 @@ regularly.
252252
Restrict which fields you wish to autocomplete. Field is a BibTeX field (e.g.
253253
`author`, `doi`,...). So if you only wish to add missing DOIs use `-c doi`.
254254

255+
- `-b --filter-fields-by-entrytype <required|optional|all>` only add fields that correspond to
256+
the given entry type in bibtex's data model. Disabled by default. `required`
257+
only adds required fields, `optional` adds required and optional fields, and
258+
`all` adds required, optional and non-standard fields (doi, issn and isbn).
259+
A list of required/optional fields by entry type can be found
260+
[on the tex stackexchange](https://tex.stackexchange.com/questions/239042/where-can-we-find-a-list-of-all-available-bibtex-entries-and-the-available-fiel)
261+
255262
- `-w --overwrite <field>` or `-W --dont-overwrite <field>`
256263

257264
Force overwriting of the selected fields. If using `-W author -W journal`
258265
your force overwrite of all fields except `author` and `journal`. The
259266
default is to override nothing (only complete absent and blank fields).
260267

261268
For a more complex example `btac -C doi -w author` means complete all fields
262-
save DOI, and only overwrite author fields
269+
save DOI, and only overwrite author fields.
263270

264271
You can also use the `-f` flag to overwrite everything or the `-p` flag to add
265272
a prefix to new fields, thus avoiding overwrites.

bibtexautocomplete/core/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def main(argv: Optional[List[str]] = None) -> None:
136136
fields_to_protect_uppercase=fields_to_protect_uppercase,
137137
escape_unicode=args.escape_unicode,
138138
diff_mode=args.diff,
139-
filter_by_entrytype=args.by_entrytype,
139+
filter_by_entrytype=args.filter_fields_by_entrytype,
140140
)
141141
completer.print_filters()
142142
try:

bibtexautocomplete/core/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def get_bibfiles(input: Path) -> List[Path]:
113113
parser.add_argument("--only-complete", "-c", action="append", default=[], choices=FIELD_NAMES)
114114
parser.add_argument("--dont-overwrite", "-W", action="append", default=[], choices=FIELD_NAMES)
115115
parser.add_argument("--overwrite", "-w", action="append", default=[], choices=FIELD_NAMES)
116-
parser.add_argument("--by-entrytype", "-b", default="no", choices=["required", "optional", "all"])
116+
parser.add_argument("--filter-fields-by-entrytype", "-b", default="no", choices=["required", "optional", "all"])
117117

118118
parser.add_argument("--exclude-entry", "-E", action="append", default=[])
119119
parser.add_argument("--only-entry", "-e", action="append", default=[])
@@ -192,7 +192,7 @@ def get_bibfiles(input: Path) -> List[Path]:
192192
{FgYellow}-c --only-complete{Reset} {FgGreen}<field>{Reset} Only complete the given fields
193193
{FgYellow}-C --dont-complete{Reset} {FgGreen}<field>{Reset} Don't complete the given fields
194194
Field is a bibtex field (e.g. 'author', 'doi',...)
195-
{FgYellow}-b --by-entrytype{Reset} {FgGreen}required|optional|all{Reset} Disabled by default
195+
{FgYellow}-b --filter-fields-by-entrytype{Reset} {FgGreen}required|optional|all{Reset} Disabled by default
196196
Only add fields defined as part of given entry type by bibtex (e.g. no
197197
'publisher' on '@article'). 'required' only adds required fields,
198198
'optional' adds required and optional, 'all' adds required, optional and

0 commit comments

Comments
 (0)