Skip to content

Commit 96b88ad

Browse files
Add some description for UnityDataTool --help
Include link to the online documentation, this should help agents self-discovery.
1 parent 74ef49a commit 96b88ad

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

UnityDataTool/Program.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.CommandLine;
33
using System.CommandLine.Invocation;
44
using System.IO;
5+
using System.Reflection;
56
using System.Threading.Tasks;
67
using UnityDataTools.Analyzer;
78
using UnityDataTools.FileSystem;
@@ -24,7 +25,7 @@ public static async Task<int> Main(string[] args)
2425
{
2526
UnityFileSystem.Init();
2627

27-
var rootCommand = new RootCommand();
28+
var rootCommand = new RootCommand(BuildRootDescription());
2829
rootCommand.AddCommand(BuildAnalyzeCommand());
2930
rootCommand.AddCommand(BuildFindRefsCommand());
3031
rootCommand.AddCommand(BuildDumpCommand());
@@ -38,6 +39,30 @@ public static async Task<int> Main(string[] args)
3839
return r;
3940
}
4041

42+
const string DocumentationUrl = "https://github.com/Unity-Technologies/UnityDataTools/blob/main/Documentation/unitydatatool.md";
43+
44+
static string BuildRootDescription()
45+
{
46+
var version = Assembly.GetExecutingAssembly()
47+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
48+
?? Assembly.GetExecutingAssembly().GetName().Version?.ToString()
49+
?? "unknown";
50+
51+
// Strip the SourceLink build-metadata suffix (e.g. "1.3.5+<commit>").
52+
var plusIndex = version.IndexOf('+');
53+
if (plusIndex >= 0)
54+
version = version.Substring(0, plusIndex);
55+
56+
return
57+
"UnityDataTool inspects and analyzes Unity file formats, for example the content formats for AssetBundles, " +
58+
"Player and content directory builds. It can build a database of the Unity objects and their " +
59+
"references for analysis, dump objects as text, and examine " +
60+
"archive and SerializedFile internals.\n\n" +
61+
"Run 'UnityDataTool [command] --help' for detailed help on a specific command.\n\n" +
62+
$"Documentation: {DocumentationUrl}\n" +
63+
$"Version: {version}";
64+
}
65+
4166
static Command BuildAnalyzeCommand()
4267
{
4368
var pathArg = new Argument<DirectoryInfo>("path", "The path to the directory containing the files to analyze").ExistingOnly();

0 commit comments

Comments
 (0)