-
Notifications
You must be signed in to change notification settings - Fork 3
Extensible Architecture Discussion
This page serves to help decide the architecture for this project.
See Extensible Architecture for Rust, a question I posed in the Rust Programming Language Forum.
π Hello everyone! I'm building a new thing and I need some advice on architecture.
I think I want to build a command architecture like git, whereby the base command is extensible with subsequent command modifiers.
To illustrate, there's a cool repo named git-extras 1 wherein you can call (for example) $ git info and that, in turn, delegates to a separately packaged extra named git-info 1. This sort of extensibility in git is really nice. I think I want to make something like this, as opposed to a monolith.
My questions
- Does anyone know, what is this type of command architecture called?
- Do you know if there's rust a repository that uses this architecture that I could use as a rough guide?
Thanks to all in advance! π
The answer from @jameseb7 is brilliant.
That's how cargo works. It's not particularly complex, it just runs the executable
cargo-<subcommand>(in~/.cargo/bin/or the PATH) when it encounters a subcommand that isn't in the list of built-in commands. You maybe want to start by looking at the functionexecute_external_subcommand().
So's the answer by Michael-F-Bryan
The mdbook project uses a similar system for plugins. https://github.com/rust-lang/mdBook
Therefore let's build something akin to mdBook.