forked from NotAShelf/beer
beer: initial project scaffolding
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I07c4ee715f51332893e2466b8c52f8eb6a6a6964
This commit is contained in:
parent
c9b8424bd1
commit
35ea435776
4 changed files with 99 additions and 13 deletions
49
src/main.rs
Normal file
49
src/main.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//! beer, a fast, software-rendered, Wayland-native terminal emulator.
|
||||
|
||||
use std::process::ExitCode;
|
||||
|
||||
use pound::Parse;
|
||||
|
||||
/// A fast, software-rendered, Wayland-native terminal emulator.
|
||||
#[derive(Parse)]
|
||||
#[pound(name = "beer", version = "0.0.0")]
|
||||
struct Cli {
|
||||
/// Run as a daemon hosting multiple windows.
|
||||
#[pound(long)]
|
||||
server: bool,
|
||||
}
|
||||
|
||||
fn main() -> ExitCode {
|
||||
init_logging();
|
||||
match run(Cli::parse()) {
|
||||
Ok(()) => ExitCode::SUCCESS,
|
||||
Err(err) => {
|
||||
tracing::error!("{err:#}");
|
||||
eprintln!("beer: {err:#}");
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn init_logging() {
|
||||
use tracing_subscriber::{EnvFilter, fmt};
|
||||
|
||||
let filter = EnvFilter::try_from_env("BEER_LOG")
|
||||
.or_else(|_| EnvFilter::try_from_default_env())
|
||||
.unwrap_or_else(|_| EnvFilter::new("warn"));
|
||||
|
||||
fmt()
|
||||
.with_env_filter(filter)
|
||||
.with_writer(std::io::stderr)
|
||||
.init();
|
||||
}
|
||||
|
||||
fn run(cli: Cli) -> anyhow::Result<()> {
|
||||
if cli.server {
|
||||
tracing::info!("starting beer server");
|
||||
todo!("server mode")
|
||||
}
|
||||
|
||||
tracing::info!("starting beer");
|
||||
todo!("window mode")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue