diff --git a/.github/codecov.yml b/.github/codecov.yml index 14994f63..5f4b0027 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -12,7 +12,7 @@ coverage: ignore: - "tests" - "hls" - - "book-lints" + - "book-gen" # Make comments less noisy comment: diff --git a/Cargo.lock b/Cargo.lock index 76abd4e2..511a7f09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1461,10 +1461,12 @@ dependencies = [ ] [[package]] -name = "hemtt-book-lints" +name = "hemtt-book-gen" version = "0.1.0" dependencies = [ "arma3-wiki", + "clap", + "hemtt", "hemtt-common", "hemtt-config", "hemtt-sqf", diff --git a/Cargo.toml b/Cargo.toml index 45092d39..3f65eda4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ members = [ "bin", - "book-lints", + "book-gen", "hls", diff --git a/bin/src/commands/build.rs b/bin/src/commands/build.rs index 1c8059d9..33985d53 100644 --- a/bin/src/commands/build.rs +++ b/bin/src/commands/build.rs @@ -9,9 +9,27 @@ use crate::{ use super::global_modules; #[derive(clap::Parser)] +#[command(verbatim_doc_comment)] /// Build the project for final testing /// -/// Build your project in release mode for testing, without signing for full release. +/// `hemtt build` will build your mod into `.hemttout/build`. +/// It will binarize all applicable files, and will not +/// create folder links like [`hemtt dev`](./dev.md). +/// +/// It is intended to be used for testing your mod locally before release. +/// +/// ## Configuration +/// +/// **.hemtt/project.toml** +/// +/// ```toml +/// [hemtt.build] +/// optional_mod_folders = false # Default: true +/// ``` +/// +/// ### `optional_mod_folders` +/// +/// By default, `hemtt build` will create separate mods for each optional mod folder. pub struct Command { #[clap(flatten)] build: BuildArgs, @@ -28,9 +46,15 @@ pub struct Command { pub struct BuildArgs { #[arg(long, action = clap::ArgAction::SetTrue)] /// Do not binarize the project + /// + /// They will be copied directly into the PBO. `config.cpp`, `*.rvmat`, `*.ext` will still be rapified. + /// This can be configured per addon in [`addon.toml`](../configuration/addon#binarize). no_bin: bool, #[arg(long, action = clap::ArgAction::SetTrue)] /// Do not rapify (cpp, rvmat) + /// + /// They will be copied directly into the PBO. + /// This can be configured per addon in [`addon.toml`](../configuration/addon#rapify). no_rap: bool, } diff --git a/bin/src/commands/check.rs b/bin/src/commands/check.rs index 4460c8fd..a8588538 100644 --- a/bin/src/commands/check.rs +++ b/bin/src/commands/check.rs @@ -8,7 +8,11 @@ use crate::{ }; #[derive(clap::Parser)] -/// Check the project for errors +/// Checks the project for errors +/// +/// `hemtt check` is the quickest way to check your project for errors. +/// All the same checks are run as [`hemtt dev`](./dev.md), but it will not +/// write files to disk, saving time and resources. pub struct Command { #[clap(flatten)] global: crate::GlobalArgs, diff --git a/bin/src/commands/dev.rs b/bin/src/commands/dev.rs index 04b1147d..572d0aac 100644 --- a/bin/src/commands/dev.rs +++ b/bin/src/commands/dev.rs @@ -12,10 +12,27 @@ use crate::{ use super::JustArgs; #[derive(clap::Parser)] +#[command(verbatim_doc_comment)] /// Build the project for development /// -/// Build your project for local development and testing. -/// It is built without binarization of .p3d and .rtm files. +/// `hemtt dev` is designed to help your development workflows. +/// It will build your mod into `.hemttout/dev`, with links back +/// to the original addon folders. This allows you to use +/// file-patching with optional mods for easy development. +/// +/// ## Configuration +/// +/// **.hemtt/project.toml** +/// +/// ```toml +/// [hemtt.dev] +/// exclude = ["addons/unused"] +/// ``` +/// +/// ### exclude +/// +/// A list of addons to exclude from the development build. +/// Includes from excluded addons can be used, but they will not be built or linked. pub struct Command { #[clap(flatten)] dev: DevArgs, @@ -30,17 +47,28 @@ pub struct Command { #[derive(clap::Args)] #[allow(clippy::module_name_repetitions)] pub struct DevArgs { - #[arg(long, short, action = clap::ArgAction::SetTrue)] + #[arg(long, short, action = clap::ArgAction::SetTrue, verbatim_doc_comment)] /// Use BI's binarize on supported files + /// + /// By default, `hemtt dev` will not binarize any files, but rather pack them as-is. + /// Binarization is often not needed for development. binarize: bool, - #[arg(long = "optional", short, action = clap::ArgAction::Append)] + #[arg(long, short, action = clap::ArgAction::Append, verbatim_doc_comment)] /// Include an optional addon folder - optionals: Vec, - #[arg(long, short = 'O', action = clap::ArgAction::SetTrue)] + /// + /// This can be used multiple times to include multiple optional addons. + /// + /// ```bash + /// hemtt dev -o caramel -o chocolate + /// ``` + optional: Vec, + #[arg(long, short = 'O', action = clap::ArgAction::SetTrue, conflicts_with = "optional", verbatim_doc_comment)] /// Include all optional addon folders all_optionals: bool, - #[arg(long, action = clap::ArgAction::SetTrue)] + #[arg(long, action = clap::ArgAction::SetTrue, verbatim_doc_comment)] /// Do not rapify (cpp, rvmat) + /// + /// They will be copied directly into the PBO, not .bin version is created. no_rap: bool, } @@ -66,7 +94,7 @@ pub fn context( ) -> Result { let all_optionals = dev.all_optionals; let optionals = dev - .optionals + .optional .iter() .map(std::string::String::as_str) .collect::>(); diff --git a/bin/src/commands/launch/mod.rs b/bin/src/commands/launch/mod.rs index 3ed1e72d..35223484 100644 --- a/bin/src/commands/launch/mod.rs +++ b/bin/src/commands/launch/mod.rs @@ -24,10 +24,156 @@ use crate::{ }; #[derive(clap::Parser)] +#[command(verbatim_doc_comment)] /// Test your project /// -/// Builds your project in dev mode and launches Arma 3 with -/// file patching enabled, loading your mod and any workshop mods. +/// `hemtt launch` is used to build and launch a dev version of your mod. +/// It will run the [`hemtt dev`](dev.md) command internally after a +/// few checks, options are passed to the `dev` command. +/// +/// You can chain multiple configurations together, and they will be +/// overlayed from left to right. Any arrays will be concatenated, +/// and any duplicate keys will be overridden. With the below configuration, +/// `hemtt launch default vn ace` would launch with all three configurations. +/// Note that `default` must be specified when specifying additional +/// configurations, `default` is only implied when no configurations are specified. +/// +/// ## Configuration +/// +/// `hemtt launch` requires the [`mainprefix`](../configuration/index.md#main-prefix) option to be set. +/// +/// Launch configurations can be stored in either `.hemtt/project.toml` under `hemtt.launch`, +/// or in a separate file under `.hemtt/launch.toml`. The latter is useful for keeping +/// your main configuration file clean. When using `launch.toml`, +/// the `hemtt.launch` key is not required. +/// +/// **.hemtt/project.toml** +/// +/// ```toml +/// mainprefix = "z" +/// +/// # Launched with `hemtt launch` +/// [hemtt.launch.default] +/// workshop = [ +/// "450814997", # CBA_A3's Workshop ID +/// ] +/// presets = [ +/// "main", # .html presets from .hemtt/presets/ +/// ] +/// dlc = [ +/// "Western Sahara", +/// ] +/// optionals = [ +/// "caramel", +/// ] +/// mission = "test.VR" # Mission to launch directly into the editor with +/// parameters = [ +/// "-skipIntro", # These parameters are passed to the Arma 3 executable +/// "-noSplash", # They do not need to be added to your list +/// "-showScriptErrors", # You can add additional parameters here +/// "-debug", +/// "-filePatching", +/// ] +/// executable = "arma3" # Default: "arma3_x64" +/// file_patching = false # Default: true +/// binarize = true # Default: false +/// rapify = false # Default: true +/// +/// # Launched with `hemtt launch vn` +/// [hemtt.launch.vn] +/// extends = "default" +/// dlc = [ +/// "S.O.G. Prairie Fire", +/// ] +/// +/// # Launched with `hemtt launch ace` +/// [hemtt.launch.ace] +/// extends = "default" +/// workshop = [ +/// "463939057", # ACE3's Workshop ID +/// ] +/// ``` +/// +/// **.hemtt/launch.toml** +/// +/// ```toml +/// [default] +/// workshop = [ +/// "450814997", # CBA_A3's Workshop ID +/// ] +/// +/// [vn] +/// extends = "default" +/// dlc = [ +/// "S.O.G. Prairie Fire", +/// ] +/// ``` +/// +/// ### extends +/// +/// The name of another configuration to extend. This will merge all +/// arrays with the base configuration, and override any duplicate keys. +/// +/// ### workshop +/// +/// A list of workshop IDs to launch with your mod. These are not +/// subscribed to, and will need to be manually subscribed to in Steam. +/// +/// ### presets +/// +/// A list of `.html` presets to launch with your mod. +/// Exported from the Arma 3 Launcher, and kept in `.hemtt/presets/`. +/// +/// ### dlc +/// +/// A list of DLCs to launch with your mod. The fullname or short-code can be used. +/// +/// Currently supported DLCs: +/// +/// | Full Name | Short Code | +/// | ------------------- | ---------- | +/// | Contact | contact | +/// | Global Mobilization | gm | +/// | S.O.G. Prairie Fire | vn | +/// | CSLA Iron Curtain | csla | +/// | Western Sahara | ws | +/// | Spearhead 1944 | spe | +/// | Reaction Forces | rf | +/// +/// ### optionals +/// +/// A list of optional addon folders to launch with your mod. +/// +/// ### mission +/// +/// The mission to launch directly into the editor with. This can be specified +/// as either the name of a folder in `.hemtt/missions/` +/// (e.g., `test.VR` would launch `.hemtt/missions/test.VR/mission.sqm`) +/// or the relative (to the project root) path to a `mission.sqm` +/// file or a folder containing it. +/// +/// ### parameters +/// +/// A list of [Startup Parameters](https://community.bistudio.com/wiki/Arma_3:_Startup_Parameters) to pass to the Arma 3 executable. +/// +/// ### executable +/// +/// The name of the Arma 3 executable to launch. +/// This is usually `arma3` or `arma3_x64`. +/// Do not include the `.exe` extension, it will be added automatically on Windows. +/// Only paths relative to the Arma 3 directory are supported. +/// +/// ### `file_patching` +/// +/// Whether to launch Arma 3 with `-filePatching`. Equivalent to `--no-filepatching` or `-F`. +/// +/// ### binarize +/// +/// Whether to use BI's binarize on supported files. Equivalent to `--binarize`. +/// +/// ### rapify +/// +/// Provides the ability to disable rapify for the launch command. Equivalent to `--no-rap`. pub struct Command { #[clap(flatten)] launch: LaunchArgs, @@ -46,19 +192,43 @@ pub struct Command { #[allow(clippy::module_name_repetitions)] pub struct LaunchArgs { #[arg(action = clap::ArgAction::Append)] - /// Launches with the specified `[hemtt.launch.]` configurations + /// Launches with the specified configurations + /// + /// Configured in either: + /// - `.hemtt/project.toml` under `hemtt.launch` + /// - `.hemtt/launch.toml` config: Option>, - #[arg(long, short)] + #[arg(long, short, verbatim_doc_comment)] /// Executable to launch, defaults to `arma3_x64.exe` + /// + /// Overrides the `executable` option in the configuration file. + /// + /// Can be either a relative path to the Arma 3 directory, or an absolute path. + /// + /// ```bash + /// -e arma3profiling_x64 # Relative to the Arma 3 directory + /// -e "C:\Program Files\Steam\steamapps\common\Arma 3\arma3_x64.exe" # Absolute path + /// ``` executable: Option, - #[arg(raw = true)] + #[arg(raw = true, verbatim_doc_comment)] /// Passthrough additional arguments to Arma 3 + /// + /// Any options after `--` will be passed to the Arma 3 executable. + /// This is useful for passing additional [Startup Parameters](https://community.bistudio.com/wiki/Arma_3:_Startup_Parameters). + /// + /// ```bash + /// hemtt launch -- -world=empty -window + /// ``` passthrough: Option>, #[arg(long, short)] /// Launches multiple instances of the game + /// + /// If unspecified, it will default to 1. instances: Option, #[arg(long = "quick", short = 'Q')] /// Skips the build step, launching the last built version + /// + /// Will throw an error if no build has been made, or no symlink exists. no_build: bool, #[arg(long = "no-filepatching", short = 'F')] /// Disables file patching diff --git a/bin/src/commands/localization/coverage.rs b/bin/src/commands/localization/coverage.rs index 68dc184d..0585d37b 100644 --- a/bin/src/commands/localization/coverage.rs +++ b/bin/src/commands/localization/coverage.rs @@ -6,9 +6,15 @@ use tabled::{settings::Style, Table, Tabled}; use crate::{context::Context, report::Report, Error, TableFormat}; -#[derive(clap::Args)] +#[derive(clap::Parser)] #[allow(clippy::module_name_repetitions)] -pub struct LocalizationCoverageArgs { +/// Generate a coverage report +/// +/// HEMTT will display a table of the coverage of +/// language localization in the project. Showing the +/// percentage, total strings, and how many +/// addons have gaps in their localization. +pub struct Command { #[arg(long, default_value = "ascii")] /// Output format format: TableFormat, @@ -79,7 +85,14 @@ struct Entry { missing: MissingAddons, } -pub fn coverage(args: &LocalizationCoverageArgs) -> Result { +/// Generate a coverage report +/// +/// # Errors +/// [`Error`] depending on the modules +/// +/// # Panics +/// If json serialization fails +pub fn coverage(cmd: &Command) -> Result { let ctx = Context::new(None, crate::context::PreservePrevious::Remove, true)?; let mut global = Totals::default(); @@ -158,11 +171,17 @@ pub fn coverage(args: &LocalizationCoverageArgs) -> Result { row!(table, global, missing, finnish); row!(table, global, missing, dutch); - match args.format { + match cmd.format { TableFormat::Ascii => { println!("{}", Table::new(&table).with(Style::modern())); } TableFormat::Json => { + println!( + "{}", + serde_json::to_string(&table).expect("Failed to print json") + ); + } + TableFormat::PrettyJson => { println!( "{}", serde_json::to_string_pretty(&table).expect("Failed to print json") diff --git a/bin/src/commands/localization/mod.rs b/bin/src/commands/localization/mod.rs index 2e69e7d2..db8c7ccd 100644 --- a/bin/src/commands/localization/mod.rs +++ b/bin/src/commands/localization/mod.rs @@ -1,7 +1,7 @@ use crate::{report::Report, Error}; -mod coverage; -mod sort; +pub mod coverage; +pub mod sort; #[derive(clap::Parser)] #[command(arg_required_else_help = true)] @@ -16,10 +16,8 @@ pub struct Command { #[derive(clap::Subcommand)] enum Subcommands { - /// Generate a coverage report - Coverage(coverage::LocalizationCoverageArgs), - /// Sort the stringtables - Sort(sort::LocalizationSortArgs), + Coverage(coverage::Command), + Sort(sort::Command), } /// Execute the localization command diff --git a/bin/src/commands/localization/sort.rs b/bin/src/commands/localization/sort.rs index 0e46bdc8..d752c338 100644 --- a/bin/src/commands/localization/sort.rs +++ b/bin/src/commands/localization/sort.rs @@ -4,15 +4,28 @@ use hemtt_stringtable::Project; use crate::{context::Context, report::Report, Error}; -#[derive(clap::Args)] +#[derive(clap::Parser)] #[allow(clippy::module_name_repetitions)] -pub struct LocalizationSortArgs { +#[command(verbatim_doc_comment)] +/// Sorts the stringtables +/// +/// HEMTT will: +/// +/// 1. Sort the Packages in alphabetical order. +/// 2. Sort the Containers in alphabetical order (if any). +/// 3. Sort the Keys in alphabetical order. +/// 4. Sort the Localized Strings in the order of [this table](https://community.bistudio.com/wiki/Stringtable.xml#Supported_Languages) +pub struct Command { #[arg(long)] /// Only sort the languages within keys only_lang: bool, } -pub fn sort(args: &LocalizationSortArgs) -> Result { +/// Sort the stringtables +/// +/// # Errors +/// [`Error`] depending on the modules +pub fn sort(cmd: &Command) -> Result { let ctx = Context::new(None, crate::context::PreservePrevious::Remove, true)?; for root in ["addons", "optionals"] { @@ -38,7 +51,7 @@ pub fn sort(args: &LocalizationSortArgs) -> Result { let mut file = std::fs::File::open(&path)?; match Project::from_reader(BufReader::new(&mut file)) { Ok(mut project) => { - if !args.only_lang { + if !cmd.only_lang { project.sort(); } let mut writer = String::new(); diff --git a/bin/src/commands/new/mod.rs b/bin/src/commands/new/mod.rs index 5ee80465..ff6f1c66 100644 --- a/bin/src/commands/new/mod.rs +++ b/bin/src/commands/new/mod.rs @@ -18,10 +18,26 @@ use crate::{ mod error; #[derive(clap::Parser)] -#[command(arg_required_else_help = true)] +#[command(arg_required_else_help = true, verbatim_doc_comment)] /// Create a new project +/// +/// `hemtt new` is used to create a new mod. It will create a new folder with the name you provide, and create some starting files. +/// +/// It will ask for: +/// +/// - The full name of your mod +/// - The author of your mod +/// - The prefix of your mod +/// - The main prefix of your mod +/// - A license for your mod pub struct Command { - #[clap(name = "name")] + #[clap(name = "name", verbatim_doc_comment)] + /// The name of the new project + /// + /// This will create a new folder with the name you provide in the current directory. + /// It should be a valid folder name, using only letters, numbers, and underscores. + /// + /// Example: `hemtt new my_mod` name: String, } diff --git a/bin/src/commands/release.rs b/bin/src/commands/release.rs index 744d804c..a7ba68af 100644 --- a/bin/src/commands/release.rs +++ b/bin/src/commands/release.rs @@ -3,9 +3,39 @@ use crate::{context::Context, error::Error, modules::Sign, report::Report}; use super::build; #[derive(clap::Parser)] +#[command(verbatim_doc_comment)] /// Build the project for release /// -/// Build your project for full release, with signing and archiving. +/// `hemtt release` will build your mod into `.hemttout/release`. +/// It will create `bisign` files for all addons, and a `bikey` for validation. +/// +/// It is intended to be used for releasing your mod. +/// +/// It will create two zip archives in the `releases` folder: - `{name}-latest.zip` - `{name}-{version}.zip` +/// +/// ## Configuration +/// +/// `hemtt release` is built the same way as [`hemtt build`](build.md), and will use its configuration. +/// +/// ```toml +/// [hemtt.release] +/// sign = false # Default: true +/// archive = false # Default: true +/// ``` +/// +/// ### sign +/// +/// If `sign` is set to `false`, a `bikey` will not be created, and the PBOs will not be signed. +/// +/// ```admonish danger +/// All public releases of your mods should be signed. This will be a requirement of +/// many communities, and is an important security feature. Do not use this +/// unless you know what you are doing. +/// ``` +/// +/// ### archive +/// +/// If `archive` is set to `false`, a zip archive will not be created. The output will be in `.hemttout/release`. pub struct Command { #[clap(flatten)] build: build::BuildArgs, @@ -20,11 +50,19 @@ pub struct Command { #[derive(clap::Args)] #[allow(clippy::module_name_repetitions)] pub struct ReleaseArgs { - #[arg(long, action = clap::ArgAction::SetTrue)] - /// Do not sign the PBOs + #[arg(long, action = clap::ArgAction::SetTrue, verbatim_doc_comment)] + /// Do not sign the PBOs or create a `bikey`. + /// + /// ```admonish danger + /// All public releases of your mods should be signed. This will be a requirement of + /// many communities, and is an important security feature. Do not use this + /// unless you know what you are doing. + /// ``` no_sign: bool, #[arg(long, action = clap::ArgAction::SetTrue)] - /// Do not create an archive of the release + /// Do not create a zip archive of the release. + /// + /// The output will be in `.hemttout/release`. no_archive: bool, } diff --git a/bin/src/commands/script.rs b/bin/src/commands/script.rs index 05d5dd2f..9f4d9f8f 100644 --- a/bin/src/commands/script.rs +++ b/bin/src/commands/script.rs @@ -1,13 +1,19 @@ use crate::{context::Context, error::Error, modules::Hooks, report::Report}; #[derive(clap::Parser)] -#[command(arg_required_else_help = true)] +#[command(arg_required_else_help = true, verbatim_doc_comment)] /// Run a Rhai script on the project /// -/// Run a Rhai script on the project, this is useful for automating tasks -/// in a platform agnostic way, or requiring external dependencies. +/// `hemtt script` is used to run a Rhai script on the project +/// This is useful for automating tasks in a platform agnostic way, +/// or requiring external dependencies. +/// +/// Learn more about [Scripts](../rhai/scripts). pub struct Command { #[clap(name = "name")] + /// The name of the script to run, without .rhai + /// + /// Scripts are kept in `.hemtt/scripts/` name: String, #[clap(flatten)] diff --git a/bin/src/lib.rs b/bin/src/lib.rs index 8153ae5f..c72714ac 100644 --- a/bin/src/lib.rs +++ b/bin/src/lib.rs @@ -214,11 +214,13 @@ pub fn is_ci() -> bool { #[derive(clap::ValueEnum, Clone, Default, Debug, serde::Serialize)] #[serde(rename_all = "kebab-case")] pub enum TableFormat { - /// ascii table + /// an ascii table for the terminal #[default] Ascii, - /// json + /// compact json, ideal for machines Json, - /// markdown table + /// pretty json, ideal for humans + PrettyJson, + /// a markdown table, ideal for documentation or GitHub Markdown, } diff --git a/bin/src/utils/paa/inspect.rs b/bin/src/utils/paa/inspect.rs index 77dacc67..e1cf237c 100644 --- a/bin/src/utils/paa/inspect.rs +++ b/bin/src/utils/paa/inspect.rs @@ -59,7 +59,8 @@ pub fn inspect(mut file: File, format: &TableFormat) -> Result<(), Error> { .with(Style::modern()) .with(Alignment::right()) ), - TableFormat::Json => println!("{}", serde_json::to_string_pretty(&data)?), + TableFormat::Json => println!("{}", serde_json::to_string(&data)?), + TableFormat::PrettyJson => println!("{}", serde_json::to_string_pretty(&data)?), TableFormat::Markdown => println!( "{}", Table::new(data) diff --git a/bin/src/utils/pbo/inspect.rs b/bin/src/utils/pbo/inspect.rs index d7a6e6ad..c9c38ce9 100644 --- a/bin/src/utils/pbo/inspect.rs +++ b/bin/src/utils/pbo/inspect.rs @@ -67,7 +67,8 @@ pub fn inspect(file: File, format: &TableFormat) -> Result<(), Error> { match format { TableFormat::Ascii => println!("{}", modify(Table::new(data).with(Style::modern()))), - TableFormat::Json => println!("{}", serde_json::to_string_pretty(&data)?), + TableFormat::Json => println!("{}", serde_json::to_string(&data)?), + TableFormat::PrettyJson => println!("{}", serde_json::to_string_pretty(&data)?), TableFormat::Markdown => println!("{}", modify(Table::new(data).with(Style::markdown()))), } diff --git a/book-lints/Cargo.toml b/book-gen/Cargo.toml similarity index 63% rename from book-lints/Cargo.toml rename to book-gen/Cargo.toml index c4ba1f75..a00dbeaa 100644 --- a/book-lints/Cargo.toml +++ b/book-gen/Cargo.toml @@ -1,15 +1,17 @@ [package] -name = "hemtt-book-lints" +name = "hemtt-book-gen" version = "0.1.0" edition = "2021" [dependencies] +hemtt = { path = "../bin" } hemtt-common = { path = "../libs/common" } hemtt-config = { path = "../libs/config" } hemtt-sqf = { path = "../libs/sqf" } hemtt-workspace = { path = "../libs/workspace" } arma3-wiki = { workspace = true } +clap = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } -mdbook = "0.4.40" -serde_json = "1.0.127" +mdbook = "0.4.42" diff --git a/book-lints/highlight.js b/book-gen/highlight.js similarity index 100% rename from book-lints/highlight.js rename to book-gen/highlight.js diff --git a/book-gen/src/commands.rs b/book-gen/src/commands.rs new file mode 100644 index 00000000..f05c6c70 --- /dev/null +++ b/book-gen/src/commands.rs @@ -0,0 +1,162 @@ +use clap::{Command, CommandFactory}; +use mdbook::book::Chapter; + +pub fn run(chapter: &mut Chapter) { + let commands = vec![ + ("new", hemtt::commands::new::Command::command()), + ("check", hemtt::commands::check::Command::command()), + ("dev", hemtt::commands::dev::Command::command()), + ("launch", hemtt::commands::launch::Command::command()), + ("build", hemtt::commands::build::Command::command()), + ("release", hemtt::commands::release::Command::command()), + ("script", hemtt::commands::script::Command::command()), + ]; + + let nested = [( + "localization", + vec![ + ( + "coverage", + hemtt::commands::localization::coverage::Command::command(), + ), + ( + "sort", + hemtt::commands::localization::sort::Command::command(), + ), + ], + )]; + + for item in &mut chapter.sub_items { + if let mdbook::BookItem::Chapter(ref mut chapter) = item { + if let Some((name, command)) = commands.iter().find(|(name, _)| *name == chapter.name) { + chapter.content = process_command(name, None, command.clone()); + } else if let Some((_, commands)) = + nested.iter().find(|(name, _)| *name == chapter.name) + { + for item in &mut chapter.sub_items { + if let mdbook::BookItem::Chapter(ref mut child_chapter) = item { + if let Some((name, command)) = commands + .iter() + .find(|(name, _)| *name == child_chapter.name) + { + child_chapter.content = + process_command(name, Some(&chapter.name), command.clone()); + } + } + } + } + } + } +} + +fn process_command(name: &str, nested: Option<&str>, mut command: Command) -> String { + let mut output = format!( + "# hemtt {}{}\n\n", + nested.map(|s| format!("{} ", s)).unwrap_or_default(), + name, + ); + + output.push_str("
");
+    output.push_str(&global_options(command.render_help().to_string()));
+    output.push_str("\n
\n\n"); + + if let Some(long_about) = command.get_long_about() { + output.push_str("## Description\n\n"); + output.push_str(&long_about.to_string()); + output.push_str("\n\n"); + } + + let args = command + .get_arguments() + .filter(|arg| { + !(arg.is_global_set() + || arg.is_hide_set() + || arg.get_short() == Some('h') + || arg.get_long() == Some("dir") + || arg.get_long() == Some("just")) + }) + .collect::>(); + if !args.is_empty() { + output.push_str("## Arguments\n\n"); + + for arg in args { + let mut header = match (arg.get_short(), arg.get_long()) { + (Some(s), Some(l)) => { + format!("-{s}, --{l}") + } + (None, Some(l)) => { + format!("--{l}") + } + (Some(s), None) => { + format!("-{s}") + } + (None, None) => String::new(), + }; + if let Some(name) = arg + .get_value_names() + .map(|w| w.iter().map(|s| s.to_string())) + .and_then(|mut l| l.next()) + { + if matches!( + arg.get_action(), + clap::ArgAction::Set | clap::ArgAction::Append + ) { + header.push_str(&format!(" <{}>", name)); + } + } + output.push_str(&format!("### {}\n\n", header)); + output.push_str( + &arg.get_long_help() + .unwrap_or_else(|| arg.get_help().unwrap_or_default()) + .to_string(), + ); + if !arg.get_possible_values().is_empty() { + output.push_str("\n\nPossible values:\n\n"); + for value in arg.get_possible_values() { + output.push_str(&format!( + "- {} - {}\n", + value.get_name(), + value.get_help().unwrap_or_default() + )); + } + } + output.push_str("\n\n"); + } + } + output +} + +fn global_options(usage: String) -> String { + let mut output = String::new(); + let usage = usage.replace("<", "<").replace(">", ">"); + usage.lines().for_each(|line| { + let mut line = line.to_string(); + + let remove = [" --dir <DIR>"]; + if remove.iter().any(|x| line.starts_with(x)) { + return; + } + + let links = [ + ( + " -t, --threads", + r#" -t, --threads"#, + ), + (" -v...", r#" -v..."#), + ( + " --just", + r#" --just"#, + ), + ]; + + for (from, to) in links.iter() { + if line.starts_with(from) { + line = format!("{}{}", to, &line[from.len()..]); + } + } + + output.push_str(&line); + output.push('\n'); + }); + output +} diff --git a/book-gen/src/highlight.rs b/book-gen/src/highlight.rs new file mode 100644 index 00000000..ab85e6e7 --- /dev/null +++ b/book-gen/src/highlight.rs @@ -0,0 +1,47 @@ +use arma3_wiki::Wiki; + +pub fn run() { + let wiki = Wiki::load(true); + + let mut flow = Vec::with_capacity(500); + let mut commands = Vec::with_capacity(3000); + + for command in wiki.commands().raw().values() { + let name = command.name(); + if name.contains(' ') || name.contains('%') || name.contains('_') || name.contains('+') { + continue; + } + if !name.is_ascii() { + continue; + } + let dest = if command.groups().iter().any(|x| x == "Program Flow") { + &mut flow + } else { + &mut commands + }; + dest.push(command.name()); + } + + // Remove special commands + commands.retain(|x| { + ![ + "call", + "callExtension", + "compile", + "compileFinal", + "exec", + "execFSM", + "execVM", + "private", + "spawn", + ] + .contains(x) + }); + + let highlight = std::fs::read_to_string("book-gen/highlight.js").unwrap(); + + let highlight = highlight.replace("$FLOW$", &format!("'{}'", flow.join("','"))); + let highlight = highlight.replace("$COMMANDS$", &format!("'{}'", commands.join("','"))); + + std::fs::write("book/highlight.js", highlight).unwrap(); +} diff --git a/book-gen/src/lints.rs b/book-gen/src/lints.rs new file mode 100644 index 00000000..95d313ce --- /dev/null +++ b/book-gen/src/lints.rs @@ -0,0 +1,84 @@ +use std::sync::Arc; + +use hemtt_config::analyze::CONFIG_LINTS; +use hemtt_sqf::analyze::{ + lints::s02_event_handlers::{ + LintS02EventIncorrectCommand, LintS02EventInsufficientVersion, LintS02EventUnknown, + }, + SqfLintData, SQF_LINTS, +}; +use hemtt_workspace::lint::{Lint, Lints}; +use mdbook::book::Chapter; + +pub fn run(chapter: &mut Chapter) { + for item in &mut chapter.sub_items { + if let mdbook::BookItem::Chapter(ref mut chapter) = item { + if chapter.name == "Config" { + config(chapter); + } + if chapter.name == "SQF" { + sqf(chapter); + } + } + } +} + +fn config(chapter: &mut Chapter) { + let mut output = String::from("# Lints - Conifg\n\n"); + let mut lint_text: Vec<(u32, String)> = Vec::new(); + for lint in CONFIG_LINTS.iter() { + lint_text.push((lint.sort(), get_text(&**lint, "L-C"))); + } + lint_text.sort_by(|a, b| a.0.cmp(&b.0)); + for (_, text) in lint_text { + output.push_str(&text); + } + chapter.content = output; +} + +fn sqf(chapter: &mut Chapter) { + let mut output = String::from("# Lints - SQF\n\n"); + let mut lint_text: Vec<(u32, String)> = Vec::new(); + let lints = SQF_LINTS + .iter() + .map(|l| (**l).clone()) + .chain({ + let lints: Lints = vec![ + Arc::new(Box::new(LintS02EventUnknown)), + Arc::new(Box::new(LintS02EventIncorrectCommand)), + Arc::new(Box::new(LintS02EventInsufficientVersion)), + ]; + lints.into_iter() + }) + .collect::>(); + for lint in lints { + lint_text.push((lint.sort(), get_text(&lint, "L-S"))); + } + lint_text.sort_by(|a, b| a.0.cmp(&b.0)); + for (_, text) in lint_text { + output.push_str(&text); + } + chapter.content = output; +} + +fn get_text(lint: &Arc>>, prefix: &str) -> String { + let mut text = String::new(); + text.push_str(&format!("\n***\n## {}\n", lint.ident())); + text.push_str(&format!("Code: **{prefix}{}** \n", lint.doc_ident())); + text.push_str(&format!( + "Default Severity: **{:?}** {} \n", + lint.default_config().severity(), + if lint.default_config().enabled() { + "" + } else { + "(Disabled)" + }, + )); + text.push_str(&format!( + "Minimum Severity: {:?} \n", + lint.minimum_severity() + )); + text.push_str(&format!("\n{}\n", lint.description())); + text.push_str(&format!("\n{}\n", lint.documentation())); + text +} diff --git a/book-gen/src/main.rs b/book-gen/src/main.rs new file mode 100644 index 00000000..94c7bd37 --- /dev/null +++ b/book-gen/src/main.rs @@ -0,0 +1,26 @@ +use mdbook::preprocess::CmdPreprocessor; + +mod commands; +mod highlight; +mod lints; + +fn main() { + if std::env::args().nth(1) == Some("supports".to_string()) { + highlight::run(); + return; + } + + let (_ctx, mut book) = CmdPreprocessor::parse_input(std::io::stdin()).unwrap(); + + for section in &mut book.sections { + if let mdbook::BookItem::Chapter(chapter) = section { + if chapter.name == "Analysis" { + lints::run(chapter); + } else if chapter.name == "Commands" { + commands::run(chapter); + } + } + } + + serde_json::to_writer(std::io::stdout(), &book).unwrap(); +} diff --git a/book-lints/src/main.rs b/book-lints/src/main.rs deleted file mode 100644 index a3a05c98..00000000 --- a/book-lints/src/main.rs +++ /dev/null @@ -1,160 +0,0 @@ -use std::sync::Arc; - -use arma3_wiki::Wiki; -use hemtt_config::analyze::CONFIG_LINTS; -use hemtt_sqf::analyze::{ - lints::s02_event_handlers::{ - LintS02EventIncorrectCommand, LintS02EventInsufficientVersion, LintS02EventUnknown, - }, - SqfLintData, SQF_LINTS, -}; -use hemtt_workspace::lint::Lints; -use mdbook::{book::Chapter, preprocess::CmdPreprocessor}; - -fn main() { - if std::env::args().nth(1) == Some("supports".to_string()) { - highlight(); - return; - } - - let (_ctx, mut book) = CmdPreprocessor::parse_input(std::io::stdin()).unwrap(); - - for section in &mut book.sections { - if let mdbook::BookItem::Chapter(chapter) = section { - if chapter.name == "Analysis" { - for item in &mut chapter.sub_items { - if let mdbook::BookItem::Chapter(ref mut chapter) = item { - if chapter.name == "Config" { - config(chapter); - } - if chapter.name == "SQF" { - sqf(chapter); - } - } - } - } - } - } - - serde_json::to_writer(std::io::stdout(), &book).unwrap(); -} - -fn config(chapter: &mut Chapter) { - let mut output = String::from("# Lints - Conifg\n\n"); - let mut lint_text: Vec<(u32, String)> = Vec::new(); - for lint in CONFIG_LINTS.iter() { - let mut text = String::new(); - text.push_str(&format!("\n***\n## {}\n", lint.ident())); - text.push_str(&format!("Code: **L-C{}** \n", lint.doc_ident())); - text.push_str(&format!( - "Default Severity: **{:?}** {} \n", - lint.default_config().severity(), - if lint.default_config().enabled() { - "" - } else { - "(Disabled)" - }, - )); - text.push_str(&format!( - "Minimum Severity: {:?} \n", - lint.minimum_severity() - )); - text.push_str(&format!("\n{}\n", lint.description())); - text.push_str(&format!("\n{}\n", lint.documentation())); - lint_text.push((lint.sort(), text)); - } - lint_text.sort_by(|a, b| a.0.cmp(&b.0)); - for (_, text) in lint_text { - output.push_str(&text); - } - chapter.content = output; -} - -fn sqf(chapter: &mut Chapter) { - let mut output = String::from("# Lints - SQF\n\n"); - let mut lint_text: Vec<(u32, String)> = Vec::new(); - let lints = SQF_LINTS - .iter() - .map(|l| (**l).clone()) - .chain({ - let lints: Lints = vec![ - Arc::new(Box::new(LintS02EventUnknown)), - Arc::new(Box::new(LintS02EventIncorrectCommand)), - Arc::new(Box::new(LintS02EventInsufficientVersion)), - ]; - lints.into_iter() - }) - .collect::>(); - for lint in lints { - let mut text = String::new(); - text.push_str(&format!("\n***\n## {}\n", lint.ident())); - text.push_str(&format!("Code: **L-S{}** \n", lint.doc_ident())); - text.push_str(&format!( - "Default Severity: **{:?}** {} \n", - lint.default_config().severity(), - if lint.default_config().enabled() { - "" - } else { - "(Disabled)" - }, - )); - text.push_str(&format!( - "Minimum Severity: {:?} \n", - lint.minimum_severity() - )); - text.push_str(&format!("\n{}\n", lint.description())); - text.push_str(&format!("\n{}\n", lint.documentation())); - lint_text.push((lint.sort(), text)); - } - lint_text.sort_by(|a, b| a.0.cmp(&b.0)); - for (_, text) in lint_text { - output.push_str(&text); - } - chapter.content = output; -} - -fn highlight() { - let wiki = Wiki::load(true); - - let mut flow = Vec::with_capacity(500); - let mut commands = Vec::with_capacity(3000); - - for command in wiki.commands().raw().values() { - let name = command.name(); - if name.contains(' ') || name.contains('%') || name.contains('_') || name.contains('+') { - continue; - } - if !name.is_ascii() { - continue; - } - let dest = if command.groups().iter().any(|x| x == "Program Flow") { - &mut flow - } else { - &mut commands - }; - dest.push(command.name()); - } - - // Remove special commands - commands.retain(|x| { - ![ - "call", - "callExtension", - "compile", - "compileFinal", - "exec", - "execFSM", - "execVM", - "private", - "spawn", - ] - .contains(x) - }); - - let highlight = std::fs::read_to_string("book-lints/highlight.js").unwrap(); - - let highlight = highlight.replace("$FLOW$", &format!("'{}'", flow.join("','"))); - let highlight = highlight.replace("$COMMANDS$", &format!("'{}'", commands.join("','"))); - - std::fs::write("book/highlight.js", highlight).unwrap(); -} diff --git a/book.toml b/book.toml index 50266459..3285729d 100644 --- a/book.toml +++ b/book.toml @@ -22,7 +22,7 @@ build-dir = "target/book" [preprocessor] [preprocessor.lints] -command = "cargo run --bin hemtt-book-lints" +command = "cargo run --bin hemtt-book-gen" before = ["admonish"] [preprocessor.admonish] diff --git a/book/commands/build.md b/book/commands/build.md index 8fa5f1d2..168ca787 100644 --- a/book/commands/build.md +++ b/book/commands/build.md @@ -1,57 +1 @@ -# hemtt build - -
Build your project
-
-Usage: hemtt build [OPTIONS]
-
-Options:
-    --no-bin
-        Do not binarize files
-
-    --no-rap
-        Do not rapify files
-
-    --just <just>
-        Only build the specified addon
-
-    -t, --threads <threads>
-        Number of threads, defaults to # of CPUs
-
-    -v...
-        Verbosity level
-
-    -h, --help
-        Print help information (use `-h` for a summary)
-
-
- -`hemtt build` will build your mod into `.hemttout/build`. It will binarize all applicable files, and will not create folder links like [`hemtt dev`](dev.md). - -It is intended to be used for testing your mod locally before release. - -## Configuration - -**.hemtt/project.toml** - -```toml -[hemtt.build] -optional_mod_folders = false # Default: true -``` - -### optional_mod_folders - -By default, `hemtt build` will create separate mods for each optional mod folder. - -## Options - -### --no-bin - -Do not binarize any files. They will be copied directly into the PBO. `config.cpp`, `*.rvmat`, `*.ext` will still be rapified. - -This can be configured per addon in [`addon.toml`](../configuration/addon.md#binarize). - -### --no-rap - -Do not rapify any files. They will be copied directly into the PBO. - -This can be configured per addon in [`addon.toml`](../configuration/addon.md#rapify). +# This file will be generated, do not edit it manually diff --git a/book/commands/check.md b/book/commands/check.md index b68f91f5..168ca787 100644 --- a/book/commands/check.md +++ b/book/commands/check.md @@ -1,19 +1 @@ -# hemtt check - -
Check your project
-
-Usage: hemtt check [OPTIONS]
-
-Options:
-    -t, --threads <threads>
-        Number of threads, defaults to # of CPUs
-
-    -v...
-        Verbosity level
-
-    -h, --help
-        Print help information (use `-h` for a summary)
-
-
- -`hemtt check` is the quickest way to check your project for errors. All the same checks are run as [`hemtt dev`](./dev), but it will not write files to disk, saving time and resources. +# This file will be generated, do not edit it manually diff --git a/book/commands/dev.md b/book/commands/dev.md index f88f3bb3..168ca787 100644 --- a/book/commands/dev.md +++ b/book/commands/dev.md @@ -1,73 +1 @@ -# hemtt dev - -
Build your mod for local development and testing.
-
-Usage: hemtt dev [OPTIONS]
-
-Options:
-    -b, --binarize
-        Use BI's binarize on supported files
-        
-    --no-rap
-        Do not rapify files
-
-    -o, --optional <optional>
-        Include an optional addon folder
-
-    -O, --all-optionals
-        Include all optional addon folders
-
-    --just <just>
-        Only build the specified addon
-
-    -t, --threads <threads>
-        Number of threads, defaults to # of CPUs
-
-    -v...
-        Verbosity level
-
-    -h, --help
-        Print help information (use `-h` for a summary)
-
-
- -`hemtt dev` is designed to help your development workflows. It will build your mod into `.hemttout/dev`, with links back to the original addon folders. This allows you to use [file-patching](#file-patching) with optional mods for easy development. - -## Configuration - -**.hemtt/project.toml** - -```toml -[hemtt.dev] -exclude = ["addons/unused"] -``` - -### exclude - -A list of addons to exclude from the development build. Includes from excluded addons can be used, but they will not be built or linked. - -## Options - -### -b, --binarize - -By default, `hemtt dev` will not binarize any files, but rather pack them as-is. Binarization is often not needed for development, but can be enabled with the `-b --binarize` flag. - -```bash -hemtt dev -b -``` - -### -o, --optional - -Include an optional addon folder. This can be used multiple times to include multiple optional addons. - -```bash -hemtt dev -o caramel -o split -``` - -### -O, --all-optionals - -Include all optional addon folders. - -```bash -hemtt dev -O -``` +# This file will be generated, do not edit it manually diff --git a/book/commands/index.md b/book/commands/index.md index 3ec79c41..44e7f24d 100644 --- a/book/commands/index.md +++ b/book/commands/index.md @@ -1,21 +1,25 @@ # Commands +## Setup + +- [hemtt new](/commands/new.md) - Create a new project + ## Development -- [hemtt new](./new.md) - Create a new project -- [hemtt dev](./dev.md) - Build the project for local development -- [hemtt launch](./launch.md) - Launch Arma 3 with your mod and dependencies -- [hemtt build](./build.md) - Build the project for local testing +- [hemtt check](/commands/check.md) - Check the project for errors +- [hemtt dev](/commands/dev.md) - Build the project for local development +- [hemtt launch](/commands/launch.md) - Launch Arma 3 with your mod and dependencies +- [hemtt build](/commands/build.md) - Build the project for local testing ## Release -- [hemtt release](./release.md) - Build the project for release +- [hemtt release](/commands/release.md) - Build the project for release ## Options ### --just -The [`build`](./build.md) and [`dev`](./dev.md) commands can be used to build a single addon. It can be used multiple times to build multiple addons. +The [`build`](/commands/build.md) and [`dev`](/commands/dev.md) commands can be used to build a single addon. It can be used multiple times to build multiple addons. ```bash hemtt build --just myAddon diff --git a/book/commands/launch.md b/book/commands/launch.md index cec9494b..168ca787 100644 --- a/book/commands/launch.md +++ b/book/commands/launch.md @@ -1,230 +1 @@ -# hemtt launch - -
Launch Arma 3 with your mod and dependencies.
-
-Usage: hemtt launch [OPTIONS] [config]... [-- <passthrough>...]
-
-Arguments:
-  [config]...
-        Launches with the specified `hemtt.launch.` configurations
-
-  [passthrough]...
-        Passthrough additional arguments to Arma 3
-
-Options:
-    -e, --executable <executable>
-        Arma 3 executable to launch
-
-    
-
-    -i, --instances <instances>
-          Launches multiple instances of the game
-
-          [default: 1]
-
-    -Q, --quick
-        Skips the build step, launching the last built version
-
-    -b, --binarize
-        Use BI's binarize on supported files
-        
-    --no-rap
-        Do not rapify files
-
-    --no-filepatching
-        Do not enable filePatching
-
-    -o, --optional <optional>
-        Include an optional addon folder
-
-    -O, --all-optionals
-        Include all optional addon folders
-
-    -t, --threads <threads>
-        Number of threads, defaults to # of CPUs
-
-    -v...
-        Verbosity level
-        
-
-    -h, --help
-        Print help information (use `-h` for a summary)
-
-
- -`hemtt launch` is used to build and launch a dev version of your mod. It will run the [`hemtt dev`](dev.md) command internally after a few checks, options are passed to the `dev` command. - -You can chain multiple configurations together, and they will be overlayed from left to right. Any arrays will be concatenated, and any duplicate keys will be overridden. With the below configuration, `hemtt launch default vn ace` would launch with all three configurations. Note that `default` must be specified when specifying additional configurations, `default` is only implied when no configurations are specified. - -## Configuration - -`hemtt launch` requires the [`mainprefix`](../configuration/index.md#main-prefix) option to be set. - -Launch configurations can be stored in either `.hemtt/project.toml` under `hemtt.launch`, or in a separate file under `.hemtt/launch.toml`. The latter is useful for keeping your main configuration file clean. When using `launch.toml`, the `hemtt.launch` key is not required. - -**.hemtt/project.toml** - -```toml -mainprefix = "z" - -# Launched with `hemtt launch` -[hemtt.launch.default] -workshop = [ - "450814997", # CBA_A3's Workshop ID -] -presets = [ - "main", # .html presets from .hemtt/presets/ -] -dlc = [ - "Western Sahara", -] -optionals = [ - "caramel", -] -mission = "test.VR" # Mission to launch directly into the editor with -parameters = [ - "-skipIntro", # These parameters are passed to the Arma 3 executable - "-noSplash", # They do not need to be added to your list - "-showScriptErrors", # You can add additional parameters here - "-debug", - "-filePatching", -] -executable = "arma3" # Default: "arma3_x64" -file_patching = false # Default: true -binarize = true # Default: false -rapify = false # Default: true - -# Launched with `hemtt launch vn` -[hemtt.launch.vn] -extends = "default" -dlc = [ - "S.O.G. Prairie Fire", -] - -# Launched with `hemtt launch ace` -[hemtt.launch.ace] -extends = "default" -workshop = [ - "463939057", # ACE3's Workshop ID -] -``` - -**.hemtt/launch.toml** - -```toml -[default] -workshop = [ - "450814997", # CBA_A3's Workshop ID -] - -[vn] -extends = "default" -dlc = [ - "S.O.G. Prairie Fire", -] -``` - -### extends - -The name of another configuration to extend. This will merge all arrays with the base configuration, and override any duplicate keys. - -### workshop - -A list of workshop IDs to launch with your mod. These are not subscribed to, and will need to be manually subscribed to in Steam. - -### presets - -A list of `.html` presets to launch with your mod. Exported from the Arma 3 Launcher, and kept in `.hemtt/presets/`. - -### dlc - -A list of DLCs to launch with your mod. The fullname or short-code can be used. - -Currently supported DLCs: - -| Full Name | Short Code | -| ------------------- | ---------- | -| Contact | contact | -| Global Mobilization | gm | -| S.O.G. Prairie Fire | vn | -| CSLA Iron Curtain | csla | -| Western Sahara | ws | -| Spearhead 1944 | spe | -| Reaction Forces | rf | - -### optionals - -A list of optional addon folders to launch with your mod. - -### mission - -The mission to launch directly into the editor with. This can be specified as either the name of a folder in `.hemtt/missions/` (e.g., `test.VR` would launch `.hemtt/missions/test.VR/mission.sqm`) or the relative (to the project root) path to a `mission.sqm` file or a folder containing it. - -### parameters - -A list of [Startup Parameters](https://community.bistudio.com/wiki/Arma_3:_Startup_Parameters) to pass to the Arma 3 executable. - -### executable - -The name of the Arma 3 executable to launch. This is usually `arma3` or `arma3_x64`. Do not include the `.exe` extension, it will be added automatically on Windows. Only paths relative to the Arma 3 directory are supported. - -### file_patching - -Whether to launch Arma 3 with `-filePatching`. Equivalent to `--no-filepatching` or `-F`. - -### binarize - -Whether to use BI's binarize on supported files. Equivalent to `--binarize`. - -### rapify - -Provides the ability to disable rapify for the launch command. Equivalent to `--no-rap`. - -## Options - - - -### -i, --instances <instances> - -Launches multiple instances of the game. If unspecified, it will default to 1. - -```bash -hemtt launch -i 2 -``` - -### -Q, --quick - -Skips the build step, launching the last built version. -Will throw an error if no build has been made, or no symlink exists. - -```bash -hemtt launch -Q -``` - -### -e, --executable <executable> - -The Arma 3 executable to launch. Overrides the `executable` option in the configuration file. - -```bash -hemtt launch -e arma3profiling_x64 # Relative to the Arma 3 directory -hemtt launch -e "C:\Program Files\Steam\steamapps\common\Arma 3\arma3_x64.exe" # Absolute path -``` - -### --no-filepatching - -Do not launch Arma 3 with `-filePatching`. - -## Passthrough Options - -Any options after `--` will be passed to the Arma 3 executable. This is useful for passing additional [Startup Parameters](https://community.bistudio.com/wiki/Arma_3:_Startup_Parameters). - -```bash -hemtt launch -- -world=empty -window -``` +# This file will be generated, do not edit it manually diff --git a/book/commands/localization/coverage.md b/book/commands/localization/coverage.md index a5415ed6..168ca787 100644 --- a/book/commands/localization/coverage.md +++ b/book/commands/localization/coverage.md @@ -1,21 +1 @@ -# hemtt localization coverage - -
Check the coverage of the stringtable.xml files in the project.
-
-Usage: hemtt localization coverage [OPTIONS]
-
-Options:
-    -t, --threads <threads>
-        Number of threads, defaults to # of CPUs
-
-    -v...
-        Verbosity level
-
-    -h, --help
-        Print help information (use `-h` for a summary)
-
-
- -## Description - -HEMTT will display a table of the coverage of language localization in the project. Showing the percentage, total strings, and how many addons have gaps in their localization. +# This file will be generated, do not edit it manually diff --git a/book/commands/localization/sort.md b/book/commands/localization/sort.md index aa4db5d5..168ca787 100644 --- a/book/commands/localization/sort.md +++ b/book/commands/localization/sort.md @@ -1,26 +1 @@ -# hemtt localization sort - -
Sorts the stringtable.xml files in the project.
-
-Usage: hemtt localization sort [OPTIONS]
-
-Options:
-    -t, --threads <threads>
-        Number of threads, defaults to # of CPUs
-
-    -v...
-        Verbosity level
-
-    -h, --help
-        Print help information (use `-h` for a summary)
-
-
- -## Description - -HEMTT will: - -1. Sort the Packages in alphabetical order. -2. Sort the Containers in alphabetical order (if any). -3. Sort the Keys in alphabetical order. -4. Sort the Localized Strings in the order of [this table](https://community.bistudio.com/wiki/Stringtable.xml#Supported_Languages) +# This file will be generated, do not edit it manually diff --git a/book/commands/new.md b/book/commands/new.md index c1cc4523..168ca787 100644 --- a/book/commands/new.md +++ b/book/commands/new.md @@ -1,23 +1 @@ -# hemtt new - -
Create a new mod
-
-Usage: hemtt new [OPTIONS] <name>
-
-Arguments:
-  <name>  Name of the new mod
-
-Options:
-    -h, --help
-        Print help information (use `-h` for a summary)
-
- -`hemtt new` is used to create a new mod. It will create a new folder with the name you provide, and create some starting files. - -It will ask for: - -- The full name of your mod -- The author of your mod -- The prefix of your mod -- The main prefix of your mod -- A license for your mod +# This file will be generated, do not edit it manually diff --git a/book/commands/release.md b/book/commands/release.md index 30e214e9..168ca787 100644 --- a/book/commands/release.md +++ b/book/commands/release.md @@ -1,67 +1 @@ -# hemtt release - -
Build a release version your project
-
-Usage: hemtt release [OPTIONS]
-
-Options:
-    --no-sign
-        Do not sign the PBOs
-
-    --no-archive
-        Do not create a zip archive of the release
-
-    --no-bin
-        Do not binarize files
-
-    --no-rap
-        Do not rapify files
-
-    -t, --threads <threads>
-        Number of threads, defaults to # of CPUs
-
-    -v...
-        Verbosity level
-
-    -h, --help
-        Print help information (use `-h` for a summary)
-
-
- -`hemtt release` will build your mod into `.hemttout/release`. It will create `bisign` files for all addons, and a `bikey` for validation. - -It is intended to be used for releasing your mod. - -It will create two zip archives in the `releases` folder: - `{name}-latest.zip` - `{name}-{version}.zip` - -## Configuration - -`hemtt release` is built the same way as [`hemtt build`](build.md), and will use its configuration. - -```toml -[hemtt.release] -sign = false # Default: true -archive = false # Default: true -``` - -### sign - -If `sign` is set to `false`, a `bikey` will not be created, and the PBOs will not be signed. - -```admonish danger -All public releases of your mods should be signed. This will be a requirement of many communities, and is an important security feature. -``` - -### archive - -If `archive` is set to `false`, a zip archive will not be created. The output will be in `.hemttout/release`. - -## Options - -### `--no-sign` - -Do not sign the PBOs or create a `bikey`. - -### `--no-archive` - -Do not create a zip archive of the release. The output will be in `.hemttout/release`. +# This file will be generated, do not edit it manually diff --git a/book/commands/script.md b/book/commands/script.md index 61956537..168ca787 100644 --- a/book/commands/script.md +++ b/book/commands/script.md @@ -1,18 +1 @@ -# hemtt script - -
Run a Rhai script on the project
-
-Usage: hemtt script [OPTIONS] <script>
-
-Options:
-    -v...
-        Verbosity level
-
-    -h, --help
-        Print help information (use `-h` for a summary)
-
-
- -`hemtt script` is used to run a Rhai script on the project, this is useful for automating tasks in a platform agnostic way, or requiring external dependencies. - -Learn more about [Scripts](../rhai/scripts/index.md). +# This file will be generated, do not edit it manually