change project name from shulkerscript to shulkerscript-cli
This commit is contained in:
parent
3c279083c7
commit
141cdb2648
10
Cargo.toml
10
Cargo.toml
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "shulkerscript"
|
||||
name = "shulkerscript-cli"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -12,10 +12,14 @@ license = "MIT"
|
|||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[[bin]]
|
||||
name = "shulkerscript"
|
||||
path = "src/main.rs"
|
||||
|
||||
[features]
|
||||
default = ["zip", "lua"]
|
||||
lang-debug = []
|
||||
lua = ["shulkerscript-lang/lua"]
|
||||
lua = ["shulkerscript/lua"]
|
||||
zip = ["shulkerbox/zip"]
|
||||
|
||||
[dependencies]
|
||||
|
@ -24,7 +28,7 @@ colored = "2.1.0"
|
|||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
thiserror = "1.0.58"
|
||||
toml = "0.8.12"
|
||||
shulkerscript-lang = { git = "https://github.com/moritz-hoelting/shulkerscript-lang", features = ["shulkerbox"], default-features = false, rev = "899a973315ce63ff20c789a7e7a784e926efc027"}
|
||||
shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang", features = ["shulkerbox"], default-features = false, rev = "5336ffb91ed5dfa1b2fce3993d84a2876aa732a3" }
|
||||
shulkerbox = { git = "https://github.com/moritz-hoelting/shulkerbox", default-features = false, rev = "b79c9ecd6d45f9319c9083a8103ef0186839b0c0" }
|
||||
git2 = { version = "0.18.3", default-features = false }
|
||||
path-absolutize = "3.1.1"
|
||||
|
|
|
@ -7,11 +7,6 @@ pub struct ProjectConfig {
|
|||
pub pack: PackConfig,
|
||||
pub compiler: Option<CompilerConfig>,
|
||||
}
|
||||
impl ProjectConfig {
|
||||
pub fn new(pack: PackConfig, compiler: Option<CompilerConfig>) -> Self {
|
||||
Self { pack, compiler }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PackConfig {
|
||||
|
@ -26,16 +21,6 @@ pub struct PackConfig {
|
|||
pub version: String,
|
||||
}
|
||||
|
||||
impl PackConfig {
|
||||
pub fn new(name: &str, description: &str, pack_format: u8) -> Self {
|
||||
Self {
|
||||
name: name.to_string(),
|
||||
description: description.to_string(),
|
||||
pack_format,
|
||||
version: "0.1.0".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Default for PackConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
@ -56,9 +41,3 @@ pub struct CompilerConfig {
|
|||
/// The path of a folder which files and subfolders will be copied to the root of the datapack.
|
||||
pub assets: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl CompilerConfig {
|
||||
pub fn new(assets: Option<PathBuf>) -> Self {
|
||||
Self { assets }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("No file/directory found at path {0}.")]
|
||||
|
@ -12,4 +13,5 @@ pub enum Error {
|
|||
InvalidPackPathError(PathBuf),
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
pub mod cli;
|
||||
pub mod config;
|
||||
pub mod error;
|
||||
pub mod subcommands;
|
||||
pub mod terminal_output;
|
||||
pub mod util;
|
|
@ -1,7 +1,13 @@
|
|||
mod cli;
|
||||
mod config;
|
||||
mod error;
|
||||
mod subcommands;
|
||||
mod terminal_output;
|
||||
|
||||
use std::process::ExitCode;
|
||||
|
||||
use clap::Parser;
|
||||
use shulkerscript::cli::Args;
|
||||
use cli::Args;
|
||||
|
||||
fn main() -> ExitCode {
|
||||
color_eyre::install().unwrap();
|
||||
|
|
|
@ -49,7 +49,7 @@ pub fn build(_verbose: bool, args: &BuildArgs) -> Result<()> {
|
|||
.join("src"),
|
||||
)?;
|
||||
|
||||
let mut compiled = shulkerscript_lang::compile(&script_paths)?;
|
||||
let mut compiled = shulkerscript::compile(&script_paths)?;
|
||||
|
||||
let icon_path = toml_path.parent().unwrap().join("pack.png");
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ pub enum DumpState {
|
|||
pub fn lang_debug(args: &LangDebugArgs) -> Result<()> {
|
||||
match args.dump {
|
||||
DumpState::Tokens => {
|
||||
let tokens = shulkerscript_lang::tokenize(&args.path)?;
|
||||
let tokens = shulkerscript::tokenize(&args.path)?;
|
||||
if args.pretty {
|
||||
println!("{:#?}", tokens);
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@ pub fn lang_debug(args: &LangDebugArgs) -> Result<()> {
|
|||
}
|
||||
}
|
||||
DumpState::Ast => {
|
||||
let ast = shulkerscript_lang::parse(&args.path)?;
|
||||
let ast = shulkerscript::parse(&args.path)?;
|
||||
if args.pretty {
|
||||
println!("{:#?}", ast);
|
||||
} else {
|
||||
|
@ -44,7 +44,7 @@ pub fn lang_debug(args: &LangDebugArgs) -> Result<()> {
|
|||
}
|
||||
DumpState::Datapack => {
|
||||
let program_paths = super::build::get_script_paths(&args.path.join("src"))?;
|
||||
let datapack = shulkerscript_lang::transpile(&program_paths)?;
|
||||
let datapack = shulkerscript::transpile(&program_paths)?;
|
||||
if args.pretty {
|
||||
println!("{:#?}", datapack);
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,7 @@ pub fn package(_verbose: bool, args: &PackageArgs) -> Result<()> {
|
|||
.join("src"),
|
||||
)?;
|
||||
|
||||
let mut compiled = shulkerscript_lang::compile(&script_paths)?;
|
||||
let mut compiled = shulkerscript::compile(&script_paths)?;
|
||||
|
||||
let icon_path = toml_path.parent().unwrap().join("pack.png");
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
use std::{io, path::Path};
|
||||
|
||||
pub fn to_absolute_path(path: &Path) -> io::Result<String> {
|
||||
Ok(std::fs::canonicalize(path)?
|
||||
.display()
|
||||
.to_string()
|
||||
.trim_start_matches(r"\\?\")
|
||||
.to_string())
|
||||
}
|
Loading…
Reference in New Issue