diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..3b6ed8b --- /dev/null +++ b/src/main.rs @@ -0,0 +1,19 @@ +use i3blocks::component::{Component, Icon, Next, Play, Prev, Title, Volume}; + +#[tokio::main] +async fn main() -> Result<(), main_error::MainError> { + let stdin = std::io::stdin(); + match std::env::args().nth(1).as_deref().unwrap_or("icon") { + "icon" => Icon::run(stdin).await, + "next" => Next::run(stdin).await, + "play" => Play::run(stdin).await, + "prev" => Prev::run(stdin).await, + "title" => Title::run(stdin).await, + "volume" => Volume::run(stdin).await, + s => { + eprintln!("Invalid component name: {s}"); + std::process::exit(1) + } + } + .map_err(Into::into) +} |