feat: add initial
This commit is contained in:
1
crates/norun/.gitignore
vendored
Normal file
1
crates/norun/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
11
crates/norun/Cargo.toml
Normal file
11
crates/norun/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "norun"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.98"
|
||||
clap = { version = "4.5.40", features = ["derive", "env"] }
|
||||
tokio = { version = "1.46.1", features = ["full"] }
|
||||
tracing = { version = "0.1.41", features = ["log"] }
|
||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
|
29
crates/norun/src/cli.rs
Normal file
29
crates/norun/src/cli.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
use crate::cli::publish::PublishCommand;
|
||||
|
||||
mod publish;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
subcommands: CliSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum CliSubcommands {
|
||||
Publish(PublishCommand),
|
||||
}
|
||||
|
||||
pub async fn execute() -> anyhow::Result<()> {
|
||||
let cmd = Cli::parse();
|
||||
|
||||
let state = State::new();
|
||||
|
||||
match cmd.subcommands {
|
||||
CliSubcommands::Publish(cmd) => cmd.execute(&state),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
8
crates/norun/src/cli/publish.rs
Normal file
8
crates/norun/src/cli/publish.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
#[derive(clap::Parser)]
|
||||
pub struct PublishCommand {}
|
||||
|
||||
impl PublishCommand {
|
||||
pub async fn execute(&self, state: &State) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
20
crates/norun/src/main.rs
Normal file
20
crates/norun/src/main.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
mod cli;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
EnvFilter::from_default_env()
|
||||
.add_directive("norun=trace".parse().unwrap())
|
||||
.add_directive("info".parse().unwrap()),
|
||||
)
|
||||
.init();
|
||||
|
||||
tracing::info!("starting norun application");
|
||||
|
||||
cli::execute().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user