Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Integrate with the ergo ecosystem #43

Closed
vitiral opened this issue Feb 5, 2018 · 3 comments · Fixed by #70
Closed

Integrate with the ergo ecosystem #43

vitiral opened this issue Feb 5, 2018 · 3 comments · Fixed by #70

Comments

@vitiral
Copy link
Contributor

vitiral commented Feb 5, 2018

Hey @killercup, you've probably been waiting for this feature request 😄

I am nearing completion of the initial release of ergo. There is a LOT of overlap between these two crates but there is also several areas that there is not overlap.

My suggestion is to have a minimal feature set which only

  • exports the main! macro
  • exports log and envlog crates and types
  • exports structopt macro and types
  • exports failure macros and types

This would allow quicli to fit cleanly within the ergo crate ecosystem, as I have no desire for ergo to perform these operations. Theoretically I could create an ergo-cli crate which is pretty much a fork of quicli with these features -- but I don't want to do that!

Another advantage of this is that it could be part of the "story" of developing an application:

  • when you start out, use just quicli
  • when you need a larger stdlib, set features=minimal and import ergo
  • keep rusting!
@vitiral
Copy link
Contributor Author

vitiral commented Feb 5, 2018

I think this kind of "story" can also help with #19 to tell the purpose of quicli. It is an entry point for beginners and a helper when your knowledge expands.

This will help reduce the amount of "should this crate be part of quicli" discussions -- most of those could be redirected to the relevant ergo subcrate.

@killercup
Copy link
Owner

killercup commented Feb 5, 2018 via email

@vitiral
Copy link
Contributor Author

vitiral commented Feb 5, 2018

Awesome! 🎉

How about just a full-throttle feature as the only default feature (for now), and ergo will work with just no-default-features.

I would like to unify the docs as well, to tell the full story. Basically the story is this:

Getting Started Guide

This is the kind of person who is not familiar with rust, or at least not familiar with the full ecosystem and how to build an application.

They are directed to use a cargo like this:

[dependencies]
quicli = "0.X.X"
serde = "0.X.X"
# ... other `derive` dependencies

The "cookbook" guide then looks very similar to what it does today (but we will keep improving them 😄)

Next Level: full ecosystem

At the next level, they are instructed to use a Cargo.toml like this:

[dependencies]
ergo = "0.X.X"
serde = "0.X.X"
# ... other `derive` dependencies

[dependencies.quicli]
default-features = false
version = "0.X.X"

We then basically replicate the rust cookbook, as well as additional examples, using this as the ecosystem. I would like one of the primary goals of ergo to be that it should be able to do almost anything from within the rust cookbook with zero additional dependencies.

Usecase

I think I see clearly now how these two crates interact:

  • quicli is for reducing boilerplate to quickly setup a CLI application. It is intended only for --bin crates.
  • ergo is an ecosystem of crates built for high level libraries, including --bin crates. It is also split into subcrates (i.e. ergo_fs) for some lower level libraries.

Let me include a use case, which is the CLI application I am rewriting.

artifact will be (eventually) split into 3 crates. Their dependencies (roughtly) would look like this:

                 ---- artifact-data
                /       - ergo
               /
artifact-app -------- artifact-web
 - quicli               - ergo
 - ergo                 - yew
                        - gotham

As you can see, the two "high level libraries" can feel free to depend on ergo. In order for this to be ergonomic, ergo must not include libraries like StructOpt and envlogger, which should only exist in --bin crates.

Conclusion / Vision

I think these two libraries can interact very nicely, and I think our first goal can/should be to rewrite the rust Cookbook using these libraries.

I'm currently reviewing the API guidelines and plan on contacting the libz blitz team and see if we can share knoweldge/expertise. The ideal case would be that the cookbook we work on writing will be the rust cookbook once ergo and quicli are stabilized. I would like to see if bringing the libz blitz team onboard would allow those goals to align.

Before that though I am going to actually use ergo and quicli as they exists today to rewrite artifact and port some of the cookbook. I will be making frequent changes/PRs for any bugs I find.

Does that all sound like a reasonable strategy?

@vitiral vitiral changed the title Add "minimal" feature Integrate with the ergo ecosystem Feb 6, 2018
vitiral added a commit to vitiral/quicli that referenced this issue Feb 10, 2018
vitiral added a commit to vitiral/quicli that referenced this issue Feb 10, 2018
vitiral added a commit to vitiral/quicli that referenced this issue Feb 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants