commit 323ed9429b29097b0ae63b9a6fc70c3d2f747d1f
parent 9dfdbfddfa64fbfb232e2bb27da445ee45da614f
Author: Henry Unite <unitehenry@gmail.com>
Date: Sat, 24 Oct 2026 23:48:38 +0000
refactor(shell): make getLimaName private inside wrap
- Move getLimaName definition inside the wrap() function
- Consistent with prior refactors (e.g. isCommandAvailable inside init())
- getLimaName now closes over deps
Diffstat:
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/shell/wrap.ts b/shell/wrap.ts
@@ -6,7 +6,22 @@ export function wrap(
cwd: string,
command: string,
): string {
- const limaName = getLimaName(deps, cwd);
+ function getLimaName(dir: string): string | null {
+ const { logger, openpodRoot } = deps;
+ try {
+ logger.log(`get lima name for ${openpodRoot} ${dir}`);
+ const rel = path.relative(openpodRoot, dir);
+ if (rel.startsWith("..") || path.isAbsolute(rel)) {
+ return null;
+ }
+ const first = rel.split(path.sep).find((p) => p.length > 0);
+ return first || null;
+ } catch {
+ return null;
+ }
+ }
+
+ const limaName = getLimaName(cwd);
if (!limaName) {
return command;
}
@@ -19,18 +34,3 @@ export function wrap(
return wrapped;
}
-
-function getLimaName(deps: OpenpodContext, dir: string): string | null {
- const { logger, openpodRoot } = deps;
- try {
- logger.log(`get lima name for ${openpodRoot} ${dir}`);
- const rel = path.relative(openpodRoot, dir);
- if (rel.startsWith("..") || path.isAbsolute(rel)) {
- return null;
- }
- const first = rel.split(path.sep).find((p) => p.length > 0);
- return first || null;
- } catch {
- return null;
- }
-}