--!strict local process = require("@lune/process") local common = require("./common") local frkcli = require("@pkg/frkcli") local cli = frkcli.new_subcommands("build_cli", "CLI for automatic basic C# tasks") local command_build = cli:add_subcommand( "build", [[ Build the project. Additionally, you can use a replicator to replicate your built plugin to: 1. A docker container: `lune run manager -- build --replicator docker --remote-output container-id:/path/to/plugin` 2. A remote machine: `lune run manager -- build --replicator ssh --remote-output username@hostname:/path/to/plugin` 3. A docker container on a remote machine: `lune run manager -- build --replicator docker-ssh --remote-output username@hostname->container-id:/path/to/plugin` You can also use a custom replicator, as long as it's located inside `lune/manager/replicators`. ]] ) command_build:add_option( "configuration", { help = "The configuration to use for building the project", aliases = { "c" }, default = "Debug" } ) command_build:add_option( "remote-output", { help = "Path on a remote machine to copy the built project to", aliases = { "o" }, default = "" } ) command_build:add_option( "replicator", { help = "Replicator to use for copying builds to a remote machine", aliases = { "r" }, default = "ssh" } ) local command_setup = cli:add_subcommand("setup", "Setup the project") command_setup:add_positional("name", { help = "Name of the project", default = nil }) command_setup:add_flag("force", { help = "Force the setup?", aliases = { "f" } }) local parsed, err = cli:parse(process.args) if err ~= nil then error(err) end assert(parsed ~= nil) local values = parsed.result.values local flags = parsed.result.flags if parsed.command == "build" then local replicator_data = nil if values.remote_output ~= "" then replicator_data = { remote_output = values.remote_output, replicator = values.replicator, } end require("./build")(values.configuration, replicator_data) elseif parsed.command == "setup" then local setup = require("./setup") local result = setup(values.name, flags.force) if not result.ok then common.error(result.err) end end