update cli docs and fix cli scripts with new syntax

This commit is contained in:
2026-02-14 22:24:32 -06:00
parent eee06009b9
commit 860632e0fa
36 changed files with 10822 additions and 10585 deletions

View File

@@ -23,8 +23,11 @@ var clean_build = false
var clean_fetch = false
var deep = false
var dry_run = false
var i = 0
var resolved = null
var deps = null
for (var i = 0; i < length(args); i++) {
for (i = 0; i < length(args); i++) {
if (args[i] == '--build') {
clean_build = true
} else if (args[i] == '--fetch') {
@@ -74,7 +77,7 @@ var is_world_scope = (scope == 'world')
if (!is_shop_scope && !is_world_scope) {
if (scope == '.' || starts_with(scope, './') || starts_with(scope, '../') || fd.is_dir(scope)) {
var resolved = fd.realpath(scope)
resolved = fd.realpath(scope)
if (resolved) {
scope = resolved
}
@@ -96,15 +99,17 @@ if (is_shop_scope) {
// Single package
push(packages_to_clean, scope)
var _gather = null
if (deep) {
try {
var deps = pkg.gather_dependencies(scope)
_gather = function() {
deps = pkg.gather_dependencies(scope)
arrfor(deps, function(dep) {
push(packages_to_clean, dep)
})
} catch (e) {
} disruption {
// Skip if can't read dependencies
}
_gather()
}
}
@@ -168,6 +173,7 @@ if (clean_fetch) {
}
// Execute or report
var deleted_count = 0
if (dry_run) {
log.console("Would delete:")
if (length(files_to_delete) == 0 && length(dirs_to_delete) == 0) {
@@ -181,20 +187,19 @@ if (dry_run) {
})
}
} else {
var deleted_count = 0
arrfor(files_to_delete, function(f) {
try {
var _del = function() {
fd.unlink(f)
log.console("Deleted: " + f)
deleted_count++
} catch (e) {
log.error("Failed to delete " + f + ": " + e)
} disruption {
log.error("Failed to delete " + f)
}
_del()
})
arrfor(dirs_to_delete, function(d) {
try {
var _del = function() {
if (fd.is_link(d)) {
fd.unlink(d)
} else {
@@ -202,9 +207,10 @@ if (dry_run) {
}
log.console("Deleted: " + d)
deleted_count++
} catch (e) {
log.error("Failed to delete " + d + ": " + e)
} disruption {
log.error("Failed to delete " + d)
}
_del()
})
if (deleted_count == 0) {