--wip-- [skip ci]
This commit is contained in:
+14
-2
@@ -6,7 +6,8 @@ use clap::{CommandFactory, Parser};
|
||||
use clap_complete::{Shell, generate as generate_complete};
|
||||
use crete::cluster::Cluster;
|
||||
use crete::environment::PathEnvironment;
|
||||
use crete::{get_configs_path, get_repo_path, set_repo_path};
|
||||
use crete::tftp::ServerError;
|
||||
use crete::{get_configs_path, get_repo_path, set_repo_path, tftp};
|
||||
use minijinja::context;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -16,6 +17,8 @@ use crate::cli::{Cli, Commands, GlobalOpts};
|
||||
enum Error {
|
||||
#[error("No clusters where found")]
|
||||
NoClustersFound,
|
||||
#[error("Server error: {0}")]
|
||||
Server(#[from] ServerError),
|
||||
}
|
||||
|
||||
fn run_command(mut command: Command) {
|
||||
@@ -79,7 +82,8 @@ fn generate(opts: &GlobalOpts) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Error> {
|
||||
let cli = Cli::parse();
|
||||
|
||||
match cli.command {
|
||||
@@ -90,6 +94,14 @@ fn main() -> Result<(), Error> {
|
||||
"crete",
|
||||
&mut std::io::stdout(),
|
||||
),
|
||||
Commands::Serve => {
|
||||
tftp::serve(|filename| match filename {
|
||||
"ipxe.pxe" => Some(include_bytes!("../bin/ipxe.pxe").into()),
|
||||
"test" => Some(vec![1, 2, 3, 4]),
|
||||
_ => None,
|
||||
})
|
||||
.await?
|
||||
}
|
||||
};
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user