Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 53a2d6a

Browse files
committed
Rework command line args
1 parent 4d90a5c commit 53a2d6a

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ If you want to attach a debugger, you should use Unity's `Attach Unity debugger`
1313
### Example
1414

1515
```cmd
16-
./UnityDevelopmentBuildMaker.exe --gamePath "D:\SteamLibrary\steamapps\common\Unturned" --is64Bit --editorPath "D:\UnityEditors\2019.4.30f1\Editor"
16+
./UnityDevelopmentBuildMaker.exe --game-path "D:\SteamLibrary\steamapps\common\Unturned" --editor-path "D:\UnityEditors\2019.4.30f1\Editor"
1717
```
1818

1919
### Supported Command Line Options
2020

21-
| Name | Required | Description |
22-
| ------------- | ------------------ | -------------------------------------------------------------------------------------------------------- |
23-
| gamePath | :heavy_check_mark: | Root directory of the game (where the game's executable is located). |
24-
| is64Bit | :heavy_check_mark: | Is the game 64 or 32 bit. The game may crash if you specify this wrong. |
25-
| editorPath | :heavy_check_mark: | Root directory of the editor (where `Unity.exe` is located). Must be the same version the game is using. |
26-
| help | :x: | Display supported arguments. |
21+
| Name | Required | Description |
22+
| ----------- | ------------------ | -------------------------------------------------------------------------------------------------------- |
23+
| game-path | :heavy_check_mark: | Root directory of the game (where the game's executable is located). |
24+
| is-x86 | :x: | Is the game's arch x64 or x86 (x64 if not specified). The game may crash if you specify this wrong. |
25+
| editor-path | :heavy_check_mark: | Root directory of the editor (where `Unity.exe` is located). Must be the same version the game is using. |
26+
| help | :x: | Display supported arguments. |

src/UnityDevelopmentBuildMaker/MakerConfig.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,26 @@ public class MakerConfig
66
{
77
private DirectoryInfo _editorPath = null!;
88

9-
[Option("gamePath", Required = true, HelpText = "Root directory of the game.")]
9+
[Option("game-path",
10+
Required = true,
11+
HelpText = "Root directory of the game (where the game's executable is located). ")]
1012
public DirectoryInfo GamePath { get; set; } = null!;
1113

12-
[Option("is64Bit", Required = true, HelpText = "Is the game 64 or 32 bit.")]
13-
public bool Is64Bit { get; set; }
14+
[Option("is-x86",
15+
Required = false,
16+
Default = false,
17+
HelpText = "Is the game's arch x64 or x86 (x64 if not specified). The game may crash if you specify this wrong.")]
18+
public bool IsArchx86 { get; set; }
1419

15-
[Option("editorPath", Required = true, HelpText = "Root directory of the editor.")]
20+
public bool Is64Bit
21+
{
22+
get => !IsArchx86;
23+
set => IsArchx86 = !value;
24+
}
25+
26+
[Option("editor-path",
27+
Required = true,
28+
HelpText = "Root directory of the editor (where `Unity.exe` is located). Must be the same version the game is using.")]
1629
public DirectoryInfo EditorPath
1730
{
1831
get => _editorPath;

src/UnityDevelopmentBuildMaker/Program.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ internal class Program
66
{
77
private static async Task Main(string[] args)
88
{
9-
var result = Parser.Default.ParseArguments<MakerConfig>(args);
9+
var parser = new Parser(config =>
10+
{
11+
config.CaseSensitive = false;
12+
config.HelpWriter = Console.Error;
13+
config.EnableDashDash = true;
14+
});
15+
16+
var result = parser.ParseArguments<MakerConfig>(args);
1017

1118
await result.WithParsedAsync(async config =>
1219
{

0 commit comments

Comments
 (0)