| 755 | } |
| 756 | |
| 757 | void ScanCommand::Setup(CLI::App& app) |
| 758 | { |
| 759 | auto* cmd = app.add_subcommand("scan", "Recursively scan directory for BIS file formats"); |
| 760 | |
| 761 | static std::string directory; |
| 762 | static int threads = 0; |
| 763 | static bool verbose = false; |
| 764 | static bool json = false; |
| 765 | |
| 766 | cmd->add_option("directory", directory, "Directory to scan")->required()->check(CLI::ExistingDirectory); |
| 767 | cmd->add_option("-t,--threads", threads, "Number of worker threads (default: auto-detect)"); |
| 768 | cmd->add_flag("--verbose", verbose, "Print per-file results"); |
| 769 | cmd->add_flag("--json", json, "Output results as JSON"); |
| 770 | |
| 771 | cmd->callback( |
| 772 | [&]() |
| 773 | { |
| 774 | int t = threads; |
| 775 | if (t <= 0) |
| 776 | t = static_cast<int>(std::thread::hardware_concurrency()); |
| 777 | if (t <= 0) |
| 778 | t = 4; |
| 779 | |
| 780 | RunScan(directory, t, verbose, json); |
| 781 | std::exit(0); |
| 782 | }); |
| 783 | } |
| 784 | |
| 785 | } // namespace PoseidonTools |