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

@@ -16,8 +16,10 @@ var fd = use('fd')
var target_pkg = null
var prune = false
var dry_run = false
var i = 0
var resolved = null
for (var i = 0; i < length(args); i++) {
for (i = 0; i < length(args); i++) {
if (args[i] == '--prune') {
prune = true
} else if (args[i] == '--dry-run') {
@@ -43,7 +45,7 @@ if (!target_pkg) {
// Resolve relative paths to absolute paths
if (target_pkg == '.' || starts_with(target_pkg, './') || starts_with(target_pkg, '../') || fd.is_dir(target_pkg)) {
var resolved = fd.realpath(target_pkg)
resolved = fd.realpath(target_pkg)
if (resolved) {
target_pkg = resolved
}
@@ -51,27 +53,31 @@ if (target_pkg == '.' || starts_with(target_pkg, './') || starts_with(target_pkg
var packages_to_remove = [target_pkg]
var lock = null
var all_packages = null
var needed = null
if (prune) {
// Find packages no longer needed
// Get all dependencies of remaining packages
var lock = shop.load_lock()
var all_packages = shop.list_packages()
lock = shop.load_lock()
all_packages = shop.list_packages()
// Build set of all needed packages (excluding target)
var needed = {}
needed = {}
arrfor(all_packages, function(p) {
if (p == target_pkg || p == 'core') return
// Mark this package and its deps as needed
needed[p] = true
try {
var _gather = function() {
var deps = pkg.gather_dependencies(p)
arrfor(deps, function(dep) {
needed[dep] = true
})
} catch (e) {
} disruption {
// Skip if can't read deps
}
_gather()
})
// Find packages that are NOT needed