Skip to content

Commit da4262c

Browse files
unity-cli@v1.6.2 (#49)
- add `--json` output for `hub` command to print the last line of output as a json string, which contains the operation results. - updated docs - bump deps
1 parent bea6318 commit da4262c

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ unity-cli license-context
120120

121121
#### Licensing Logs
122122

123-
`licensing-logs`: Prints the Unity licensing logs.
123+
`licensing-logs`: Prints the path to the Unity Licensing Client log files.
124124

125125
```bash
126126
unity-cli licensing-logs
@@ -162,6 +162,7 @@ unity-cli hub-install
162162
`hub [options] <args...>`: Run Unity Hub command line arguments (passes args directly to the hub executable).
163163

164164
- `--verbose`: Enable verbose output.
165+
- `--json`: Prints the last line of output as a json string, which contains the operation results.
165166
- `<args...>`: Arguments to pass directly to the Unity Hub executable.
166167

167168
Lists available Unity Hub commands:

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rage-against-the-pixel/unity-cli",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "A command line utility for the Unity Game Engine.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",

src/cli.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ program.command('license-context')
149149
});
150150

151151
program.command('licensing-logs')
152-
.description('Print the path to the Unity Licensing Client log files.')
152+
.description('Prints the path to the Unity Licensing Client log files.')
153153
.action(async () => {
154154
const client = new LicensingClient();
155155
process.stdout.write(`${client.logPath()}\n`);
@@ -224,6 +224,7 @@ program.command('hub-install')
224224
program.command('hub')
225225
.description('Run commands directly to the Unity Hub. (You need not to pass --headless or -- to this command).')
226226
.option('--verbose', 'Enable verbose logging.')
227+
.option('--json', 'Prints the last line of output as a json string, which contains the operation results.')
227228
.allowUnknownOption(true)
228229
.argument('<args...>', 'Arguments to pass to the Unity Hub executable.')
229230
.action(async (args: string[], options) => {
@@ -234,7 +235,12 @@ program.command('hub')
234235
Logger.instance.debug(JSON.stringify({ args, options }));
235236

236237
const unityHub = new UnityHub();
237-
await unityHub.Exec(args, { silent: false, showCommand: Logger.instance.logLevel === LogLevel.DEBUG });
238+
const output = await unityHub.Exec(args, { silent: false, showCommand: Logger.instance.logLevel === LogLevel.DEBUG });
239+
240+
if (options.json) {
241+
process.stdout.write(`\n${JSON.stringify({ output })}\n`);
242+
}
243+
238244
process.exit(0);
239245
});
240246

0 commit comments

Comments
 (0)