shulkerscript_cli/
config.rs

1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4use shulkerscript::shulkerbox;
5
6#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7pub struct ProjectConfig {
8    pub pack: PackConfig,
9    pub compiler: Option<CompilerConfig>,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct PackConfig {
14    pub name: String,
15    pub description: String,
16    #[serde(rename = "format", alias = "pack_format")]
17    pub pack_format: u8,
18    pub version: String,
19}
20
21impl PackConfig {
22    pub const DEFAULT_NAME: &'static str = "shulkerscript-pack";
23    pub const DEFAULT_DESCRIPTION: &'static str = "A Minecraft datapack created with shulkerscript";
24    pub const DEFAULT_PACK_FORMAT: u8 = shulkerbox::datapack::Datapack::LATEST_FORMAT;
25}
26
27impl Default for PackConfig {
28    fn default() -> Self {
29        Self {
30            name: Self::DEFAULT_NAME.to_string(),
31            description: Self::DEFAULT_DESCRIPTION.to_string(),
32            pack_format: Self::DEFAULT_PACK_FORMAT,
33            version: "0.1.0".to_string(),
34        }
35    }
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct CompilerConfig {
40    /// The path of a folder which files and subfolders will be copied to the root of the datapack.
41    pub assets: Option<PathBuf>,
42}