Skip to content

Bibtex-tidy inplace formatting not getting input file #691

@MRDGH2821

Description

@MRDGH2821

Describe the bug

I have a formatter for bibtex files, which has an option to do in-place formatting using --modify, but it complains that it is not receiving input file when treefmt does infact provide input file.

DEBU formatter | bibtex-tidy: executing: /usr/bin/bunx bibtex-tidy --numeric --months --blank-lines --sort --merge --strip-enclosing-braces --drop-all-caps --sort-fields --generate-keys --modify src/references.bib
ERRO formatter | bibtex-tidy: failed to apply with options '[bibtex-tidy --numeric --months --blank-lines --sort --merge --strip-enclosing-braces --drop-all-caps --sort-fields --generate-keys --modify]': exit status 1

--modify/-m is only valid when specifying input files

traversed 19 files
emitted 19 files for processing
formatted 0 files (0 changed) in 46ms

If I run the debug specified command, then it works

/usr/bin/bunx bibtex-tidy --numeric --months --blank-lines --sort --merge --strip-enclosing-braces --drop-all-caps --sort-fields --generate-keys --modify src/references.bib
Tidying...
Done. Successfully tidied 6 entries.
0 entries merged

For the record, I do have it in src/references.bib like this:

Image

To Reproduce

Steps to reproduce the behavior:

  1. Save this file as references.bib
Details
@article{ricart1981optimal,
  title         = {An optimal algorithm for mutual exclusion in computer networks},
  author        = {Ricart, Glenn and Agrawala, Ashok K.},
  year          = 1981,
  month         = jan,
  journal       = {Communications of the ACM},
  publisher     = {Association for Computing Machinery (ACM)},
  volume        = 24,
  number        = 1,
  pages         = {9–17},
  doi           = {10.1145/358527.358537},
  issn          = {1557-7317},
  url           = {http://dx.doi.org/10.1145/358527.358537}
}

@article{a1982elections,
  title         = {Elections in a Distributed Computing System},
  author        = {Garcia-Molina},
  year          = 1982,
  month         = jan,
  journal       = {IEEE Transactions on Computers},
  publisher     = {Institute of Electrical and Electronics Engineers (IEEE)},
  volume        = {C–31},
  number        = 1,
  pages         = {48–59},
  doi           = {10.1109/tc.1982.1675885},
  issn          = {2326-3814},
  url           = {http://dx.doi.org/10.1109/TC.1982.1675885}
}
@article{lamport1978time,
  title         = {Time, clocks, and the ordering of events in a distributed system},
  author        = {Lamport, Leslie},
  year          = 1978,
  month         = jul,
  journal       = {Communications of the ACM},
  publisher     = {Association for Computing Machinery (ACM)},
  volume        = 21,
  number        = 7,
  pages         = {558–565},
  doi           = {10.1145/359545.359563},
  issn          = {1557-7317},
  url           = {http://dx.doi.org/10.1145/359545.359563}
}
@article{chandra1996unreliable,
  title         = {Unreliable failure detectors for reliable distributed systems},
  author        = {Chandra, Tushar Deepak and Toueg, Sam},
  year          = 1996,
  month         = mar,
  journal       = {Journal of the ACM},
  publisher     = {Association for Computing Machinery (ACM)},
  volume        = 43,
  number        = 2,
  pages         = {225–267},
  doi           = {10.1145/226643.226647},
  issn          = {1557-735x},
  url           = {http://dx.doi.org/10.1145/226643.226647}
}

@article{chandy1985distributed,
  title         = {Distributed snapshots: determining global states of distributed systems},
  author        = {Chandy, K. Mani and Lamport, Leslie},
  year          = 1985,
  month         = feb,
  journal       = {ACM Transactions on Computer Systems},
  publisher     = {Association for Computing Machinery (ACM)},
  volume        = 3,
  number        = 1,
  pages         = {63–75},
  doi           = {10.1145/214451.214456},
  issn          = {1557-7333},
  url           = {http://dx.doi.org/10.1145/214451.214456}
}



@article{maekawa1985surd,
  title         = {A \surd{}N algorithm for mutual exclusion in decentralized systems},
  author        = {Maekawa, Mamoru},
  year          = 1985,
  month         = may,
  journal       = {ACM Transactions on Computer Systems},
  publisher     = {Association for Computing Machinery (ACM)},
  volume        = 3,
  number        = 2,
  pages         = {145–159},
  doi           = {10.1145/214438.214445},
  issn          = {1557-7333},
  url           = {http://dx.doi.org/10.1145/214438.214445}
}
  1. Put this in treefmt.toml
[formatter.bibtex-tidy]
command = "bunx"
# tombi: format.rules.array-values-order = "ascending"
includes = ["*.bib"]
no-positional-arg-support = true
options = [
  "bibtex-tidy",
  "--numeric",
  "--months",
  "--blank-lines",
  "--sort",
  "--merge",
  "--strip-enclosing-braces",
  "--drop-all-caps",
  "--sort-fields",
  "--generate-keys",
  "--modify"
]

Expected behavior

File should be formatted

System information

treefmt v2.5.0

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions