--wip-- [skip ci]

This commit is contained in:
2026-08-26 03:27:24 +02:00
parent 6a4b994a80
commit 3efa6b82c3
4 changed files with 17 additions and 2 deletions
BIN
View File
Binary file not shown.
+2
View File
@@ -49,4 +49,6 @@ pub enum Commands {
Generate, Generate,
/// Generate completions for your current shell /// Generate completions for your current shell
ShellCompletions, ShellCompletions,
/// Test
Serve,
} }
+14 -2
View File
@@ -6,7 +6,8 @@ use clap::{CommandFactory, Parser};
use clap_complete::{Shell, generate as generate_complete}; use clap_complete::{Shell, generate as generate_complete};
use crete::cluster::Cluster; use crete::cluster::Cluster;
use crete::environment::PathEnvironment; 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 minijinja::context;
use thiserror::Error; use thiserror::Error;
@@ -16,6 +17,8 @@ use crate::cli::{Cli, Commands, GlobalOpts};
enum Error { enum Error {
#[error("No clusters where found")] #[error("No clusters where found")]
NoClustersFound, NoClustersFound,
#[error("Server error: {0}")]
Server(#[from] ServerError),
} }
fn run_command(mut command: Command) { fn run_command(mut command: Command) {
@@ -79,7 +82,8 @@ fn generate(opts: &GlobalOpts) -> Result<(), Error> {
Ok(()) Ok(())
} }
fn main() -> Result<(), Error> { #[tokio::main]
async fn main() -> Result<(), Error> {
let cli = Cli::parse(); let cli = Cli::parse();
match cli.command { match cli.command {
@@ -90,6 +94,14 @@ fn main() -> Result<(), Error> {
"crete", "crete",
&mut std::io::stdout(), &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(()) Ok(())
+1
View File
@@ -0,0 +1 @@