mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 19:45:23 +00:00
clarify CONTRIBUTING.md (#59)
- provide more links to actual locations - add link to crates documentation for newcomers
This commit is contained in:
parent
f0e1115bab
commit
b198aebdfc
@ -8,8 +8,7 @@ If you're not sure where to start, take a look at the [hot topics](#hot-topics)
|
|||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
These are pretty much the only things you need to have installed on your machine to get started with contributing to
|
These are pretty much the only things you need to have installed on your machine to get started with contributing to this project:
|
||||||
this project:
|
|
||||||
- the [Rust](https://www.rust-lang.org/tools/install) toolchain installed on your machine
|
- the [Rust](https://www.rust-lang.org/tools/install) toolchain installed on your machine
|
||||||
- any working version of [Git](https://git-scm.com/downloads)
|
- any working version of [Git](https://git-scm.com/downloads)
|
||||||
|
|
||||||
@ -98,12 +97,18 @@ The project is laid out in several rust crates that are organized in the followi
|
|||||||
|
|
||||||
|
|
||||||
### Contributing a new channel
|
### Contributing a new channel
|
||||||
Channels are just structs that implement the `OnAir` trait.
|
|
||||||
|
|
||||||
As such, channels can virtually be anything that can respond to a user query and return a result under the form of a list of entries. This means channels can be anything from conventional data sources you might want to search through (like files, git repositories, remote filesystems, environment variables etc.) to more exotic implementations that might inclue a REPL, a calculator, a web browser, search through your spotify library, your email, etc.
|
`television` is built around the concept of _channels_.
|
||||||
|
|
||||||
|
From a technical standpoint, channels are structs that implement the `OnAir` trait defined in `crates/television-channels/src/channels.rs`.
|
||||||
|
|
||||||
|
They can be anything that can respond to a user query and return a result under the form of a list of entries. This means channels can be anything from conventional data sources you might want to search through (like files, git repositories, remote filesystems, environment variables etc.) to more exotic implementations that might include a REPL, a calculator, a web browser, search through your spotify library, your email, etc.
|
||||||
|
|
||||||
|
As mentioned in [Project structure](#project-structure) `television` uses [crates](https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html) for its different subcomponents (_previewers_, _channels_, _utils_, etc).
|
||||||
|
|
||||||
When contributing a new channel, you should create a new module in the `television_channels` crate with a new struct for
|
When contributing a new channel, you should create a new module in the `television_channels` crate with a new struct for
|
||||||
your channel that implements the `OnAir` trait.
|
your channel and ensure that it implements the `OnAir` trait defined in [crates/television-channels/src/channels.rs](crates/television-channels/src/channels.rs)
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// crates/television-channels/src/channels/my_new_channel.rs
|
// crates/television-channels/src/channels/my_new_channel.rs
|
||||||
|
|
||||||
@ -117,9 +122,12 @@ impl OnAir for MyNewChannel {
|
|||||||
```
|
```
|
||||||
|
|
||||||
You should also add your channel to the `TelevisionChannel` enum in the `television_channels` crate.
|
You should also add your channel to the `TelevisionChannel` enum in the `television_channels` crate.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// crates/television-channels/src/channels.rs
|
// crates/television-channels/src/channels.rs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(ToUnitChannel, ToCliChannel, Broadcast)]
|
#[derive(ToUnitChannel, ToCliChannel, Broadcast)]
|
||||||
pub enum TelevisionChannel {
|
pub enum TelevisionChannel {
|
||||||
// Other channels
|
// Other channels
|
||||||
@ -127,10 +135,12 @@ pub enum TelevisionChannel {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
☝️ There are built-in channels in `television` that you might want to draw inspiration from if need be, they're located at [crates/television-channels/src/channels](crates/television-channels/src/channels).
|
||||||
|
|
||||||
**TODO**: document transitions between channels and previewers
|
**TODO**: document transitions between channels and previewers
|
||||||
|
|
||||||
|
|
||||||
## Hot topics
|
## Hot Topics
|
||||||
Here are some ideas for contributions that would be very welcome:
|
Here are some ideas for contributions that would be very welcome:
|
||||||
|
|
||||||
- `Customization`:
|
- `Customization`:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user