From 281c6c71122d8ea0e27c14b62bc2b262903fb9dd Mon Sep 17 00:00:00 2001 From: filoxenace Date: Tue, 23 Sep 2025 23:33:01 -0400 Subject: [PATCH] add better docs to newer features --- lib/cli.luau | 3 +++ lib/core.luau | 1 + lib/fileproc.luau | 2 ++ 3 files changed, 6 insertions(+) diff --git a/lib/cli.luau b/lib/cli.luau index eb5c7eb..2c8a1b9 100644 --- a/lib/cli.luau +++ b/lib/cli.luau @@ -12,6 +12,7 @@ export type CLI = { local cli = {} :: CLI +-- parses command line arguments into options function cli.parseArgs(): types.opts local args = process.args local opts = { @@ -68,6 +69,7 @@ function cli.parseArgs(): types.opts return opts end +-- prints usage instructions for the command line tool function cli.printUsage() stdio.write(stdio.color("red")) stdio.write("Error: Please provide file path(s) or use --directory flag.\n") @@ -83,6 +85,7 @@ function cli.printUsage() stdio.write(stdio.color("reset")) end +-- checks if output file exists to prevent overwriting function cli.checkOutputFile(outputFile: string?) if outputFile and fs.isFile(outputFile) then stdio.write(stdio.color("red")) diff --git a/lib/core.luau b/lib/core.luau index bbc3cb5..25a9466 100644 --- a/lib/core.luau +++ b/lib/core.luau @@ -54,6 +54,7 @@ function core.fileContainsWorkspace(fileContents: string, opts: types.opts): boo return core.scanForWorkspace(instances, opts.printInstanceNames) end +-- formats the workspace detection result as a colored string function core.formatResult(result: boolean, fileName: string): string assert(typeof(result) == "boolean", "Expected result to be of type 'boolean'") assert(typeof(fileName) == "string", "Expected fileName to be of type 'string'") diff --git a/lib/fileproc.luau b/lib/fileproc.luau index c355e71..506a78d 100644 --- a/lib/fileproc.luau +++ b/lib/fileproc.luau @@ -14,6 +14,7 @@ export type FileProc = { local fileproc = {} :: FileProc +-- collects files to process from command line args or directory function fileproc.collectFiles(opts: types.opts): {string} assert(typeof(opts) == "table", "Expected opts to be of type 'table'") local filesToProcess = opts.filesToProcess or {} @@ -53,6 +54,7 @@ function fileproc.collectFiles(opts: types.opts): {string} return filesToProcess end +-- processes each file and checks for workspace instances function fileproc.processFiles(filesToProcess: {string}, opts: types.opts): {string} assert(typeof(filesToProcess) == "table", "Expected filesToProcess to be of type 'table'") assert(typeof(opts) == "table", "Expected opts to be of type 'table'")