Add package.json discovery

This commit is contained in:
SkyfallWasTaken 2024-07-09 21:16:17 +01:00
parent 7117a31926
commit 450e02e54b
5 changed files with 54 additions and 6 deletions

View file

@ -9,4 +9,6 @@ color-eyre = "0.6.3"
owo-colors = "4.0.0"
reqwest = "0.12.5"
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
dinopkg-package-json = { path = "../dinopkg-package-json" }
dinopkg-package-json = { path = "../dinopkg-package-json", features = [
"tokio",
] }

View file

@ -1,3 +1,8 @@
use color_eyre::Result;
use dinopkg_package_json::PackageJson;
pub async fn run(script_name: Option<String>) {}
pub async fn run(script_name: Option<String>) -> Result<()> {
let package_json = PackageJson::from_file(10).await?;
println!("Running script: {:?} {}", script_name, package_json.name);
Ok(())
}

View file

@ -1,12 +1,14 @@
use clap::Parser;
mod command;
use color_eyre::Result;
use command::{Cli, Command};
#[tokio::main]
async fn main() {
async fn main() -> Result<()> {
let cli = Cli::parse();
match cli.command {
Command::Run { script_name } => command::run::run(script_name).await,
Command::Run { script_name } => command::run::run(script_name).await?,
}
Ok(())
}