game-wip-dontplay/src/cmdline.rs
2023-04-17 19:35:19 +02:00

40 lines
668 B
Rust

use clap::Parser;
use crate::{command::Cmd, math::WorldPos};
#[derive(Parser)]
pub enum CmdLine {
Quit,
Freecam,
Clear,
Tp(Tp),
Spawn,
Give(Give),
}
#[derive(Parser)]
pub struct Tp {
x: u32,
y: u32,
/// Relative to current position
#[arg(short, long)]
rel: bool,
}
impl Tp {
fn to_world_pos(&self) -> WorldPos {
loop {}
}
}
#[derive(Parser)]
pub struct Give {
name: String,
}
pub enum Dispatch {
Cmd(Cmd),
ClearConsole,
}
impl CmdLine {
pub fn parse_cmdline(cmdline: &str) -> anyhow::Result<Self> {
loop {}
}
pub(crate) fn dispatch(self) -> Dispatch {
loop {}
}
}