Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor and polish the source code of the library #29

Merged

Commits on Jun 16, 2023

  1. rename the library into nu_formatter

    the goal of this commit is to make a clear distinction between
    the library which does all the heavy lifting and the binary
    application which mainly just parses the arguments and calls the
    library.
    
    because i think the application is clearly called `nufmt` i
    propose here to change the name of the library to `nu_formatter`.
    i also thought about `nufmt_lib`!
    
    this has the huge benefit of making two separate items in the
    `cargo doc` instead of two with the same `nufmt` name :/
    
    ```
    cargo doc --document-private-items --bin nufmt --open
    ```
    directly opens the doc on the application page with the help and
    the usage, which i find bette :)
    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    cb90243 View commit details
    Browse the repository at this point in the history
  2. link the main.rs doc to the README

    this commit is here to make the maintainance of the doc easier:
    change the README and bam, the doc of the `nufmt` binary is up-to-date!
    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    d172e01 View commit details
    Browse the repository at this point in the history
  3. run *Clippy* on --all-targets

    otherwise, warnings from the documentation and the benchmarks
    for instance are not seen when running the CI or `toolkit clippy` :o
    
    we also make sure we use the same clippy command in the toolkit.
    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    e662352 View commit details
    Browse the repository at this point in the history
  4. use log instead of print except with formatting a string

    when formatting a string from stdin we need to return the result
    directly to stdout.
    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    e8dd93a View commit details
    Browse the repository at this point in the history
  5. fix the cli.files hack

    in order to have a slice from `cli.files`, i think `cli.files[..]`,
    i.e. the whole slice from `cli.files`, is easier to work with than
    `&*cli.files` and does not require any additional comment.
    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    5b5f117 View commit details
    Browse the repository at this point in the history
  6. implement the "windows newline" trick

    because on windows we add `\r\n` and only `\n` on linux, we can
    just conditionally add `\r` when on windows and then always add
    `\n`.
    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    d4bb23a View commit details
    Browse the repository at this point in the history
  7. use a more expressive exit_code enum

    this commit also removes the `Result` and `Ok` because there is no
    such error at all in `nu_formatter` for now.
    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    eae1b46 View commit details
    Browse the repository at this point in the history
  8. simplify the benchmark

    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    0dbb734 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    880ecc1 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    98324ec View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    c183e04 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    13b91dc View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    3433524 View commit details
    Browse the repository at this point in the history
  14. fix the visibility of nu_formatter items

    - `trim_ascii_whitespaces` is never used outside `formatting`
    - the `formatting` commands are only used internally
    amtoine committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    fd032a0 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    a43cc16 View commit details
    Browse the repository at this point in the history