-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Initial library support #679
Conversation
Thank you very much for looking into this! The changes here look great. There are a few things that I would like to know before merging this:
|
Absolutely! Would happily deprecate prettyprint in favor of bat-as-a-library. 😊
If we could have the builder pattern, that would be great. I think that was quite well received from the few users that integrated prettyprint into their crates. rust-derive-builder is where it's at. If anyone likes to copy the code directly from prettyprint, please go ahead. |
@DrSensor Could you please run |
Thank you very much. Happy to merge this if we can somehow clarify point 1 and 3 from my comment above |
Not yet, I want to add examples/*.rs first before answering the comment. |
Finally done 8caca23 ✔
I agree with this though I still want use the low-level/original API for several use-cases. Maybe put the builder-pattern version in different crate via workspace 🤔 the project structure might be something like this:
Unfortunately I'm not familiar with both CI, especially Appveyor. More specifically about what and where the credentials should be put on. The changes are made because the fixtures ( If the CI does release on tagging, you can checkout this PR and tag them with a fake version to test things out.Assuming hub is installed, run
then remove the Draft/Release along with Tag after you have verified it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates. I only have minor comments/questions regarding the examples.
We can definitely expose the low-level API, but I think it will be possible to additionally expose a builder-style high-level API. No need for a different crate, hopefully. This can be done in a separate PR. |
The deployment test was successful! Thank you for the hint about just tagging a release from the feature branch. Hadn't thought of that. |
* Move {controller,output,printer,decorations}.rs into src/bin/ * Add `mod errors` from main.rs
This will limit [[bin]] to *bat* only which will make: - `cargo run` works without specifying --bin - prevent `cargo build --bins` to produce multiple binaries (app,clap_app,...)
* Change `mod errors` in lib.rs to public * Add `fn handle_error` in lib.rs errors module
others: bin/bat/{controller,decorations,output,printer}.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the updates!
I will probably work a bit on the two example files, but there is nothing preventing this from being merged 👍
Project Structure
Cargo has a convention where other executables can be placed in src/bin/*.rs. This PR use that convention which move some
src/*.rs
that depend onapp.rs
,clap_app.rs
, or clap crate intosrc/bin/bat
. Summary, the src directory became:Build and run