[#49] Improve analyze file specification, CLI help and docs improvements#76
Merged
Conversation
Include link to the online documentation, this should help agents self-discovery.
Apply similar refactoring to other commands, helps scale as we add more options.
The analyze command now takes a variadic positional argument: each path may be a file or a directory. Directories are scanned (honoring --search-pattern/--no-recurse); explicitly named files are analyzed directly. This makes analyzing a single file simple and lets files from multiple locations (e.g. a build output directory plus an external build report) go into one database in a single invocation. - AnalyzerTool.AnalyzeOptions.Paths replaces the single Path; CollectFiles expands inputs, dedups, and tracks per-input roots for relative display. - Convert tests that used the awkward ". -p <file>" form to pass paths directly; add coverage for the directory-plus-external-file case. - Document the new usage in command-analyze.md, analyzer.md and buildreport.md (including the Unity 6.6 build history workflow). Fixes #49
Lead with the fact that the bundled library normally needs no action, state that it is backward but not forward compatible, fix the copy destination path (UnityFileSystem/ at the repo root, not UnityDataTool/UnityFileSystem/), and hyperlink the library files.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #49 by improving how UnityDataTool analyze specifies input files/locations, enabling multi-path (files and/or directories) analysis in a single invocation, and updates CLI help and documentation accordingly.
Changes:
- Update
analyzeCLI to accept one-or-more file/directory paths and pass them through anAnalyzeOptionsstruct to the analyzer. - Add file collection/expansion logic to deduplicate and track per-input roots for relative-path display.
- Update tests and docs to reflect the new multi-path usage and improved help text.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| UnityDataTool/Program.cs | Updates root help text and changes analyze to accept variadic paths and call the analyzer via AnalyzeOptions. |
| Analyzer/AnalyzerTool.cs | Refactors analyze entry point to take an options object and adds multi-path file collection logic. |
| UnityDataTool.Tests/UnityDataToolPlayerDataTests.cs | Updates tests to pass a file path directly instead of directory + -p filtering. |
| UnityDataTool.Tests/SerializedFileCommandTests.cs | Updates analyze invocation in cross-validation test to use direct file input. |
| UnityDataTool.Tests/BuildReportTests.cs | Updates build report tests for direct-file analyze and adds a new directory+external-file coverage test. |
| Documentation/command-analyze.md | Documents new <paths>... usage and examples for single-file and multi-location analysis. |
| Documentation/buildreport.md | Updates guidance for cross-referencing build output + build report and multi-report workflows (including Unity 6.6 build history). |
| Documentation/analyzer.md | Updates library docs to reflect multi-path behavior. |
| README.md | Clarifies UnityFileSystemApi usage and links bundled native libraries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+147
to
+165
| var searchOption = m_Options.NoRecursion ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories; | ||
| var collected = new List<(string FullPath, string DisplayRoot)>(); | ||
| var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase); | ||
|
|
||
| foreach (var inputPath in m_Options.Paths) | ||
| { | ||
| if (Directory.Exists(inputPath)) | ||
| { | ||
| foreach (var file in Directory.GetFiles(inputPath, m_Options.SearchPattern, searchOption)) | ||
| { | ||
| if (seen.Add(Path.GetFullPath(file))) | ||
| collected.Add((file, inputPath)); | ||
| } | ||
| } | ||
| else if (File.Exists(inputPath)) | ||
| { | ||
| if (seen.Add(Path.GetFullPath(inputPath))) | ||
| collected.Add((inputPath, Path.GetDirectoryName(Path.GetFullPath(inputPath)))); | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Primarily fixes #49 (improve how
analyzespecifies input files), plus a couple of related CLI/help and refactor improvements that were on this branch.analyzenow takes multiple file or directory paths (#49)The positional argument is now variadic — each path may be a file or a directory:
--search-pattern/--no-recurse); explicitly named files are analyzed directly.AnalyzerTool.AnalyzeOptions.Pathsreplaces the singlePath; a newCollectFiles()expands inputs, dedups, and tracks per-input roots for relative-path display.CLI help improvements
--helpnow has a description, the documentation URL, and the version number (read from the assembly).AnalyzerTool.Analyzerefactored to take an options struct (matchingTextDumperTool).Documentation
command-analyze.md,analyzer.md: document the new multi-path usage.buildreport.md: cross-referencing build output + report, and the Unity 6.6 build history workflow.README.md: clarified the "Getting UnityFileSystemApi" section (bundled library normally needs no action; backward but not forward compatible; fixed copy path; hyperlinked the files).Testing
". -p <file>"form to pass file paths directly.UnityDataTool.Testssuite passes (212 tests).Fixes #49