switch to length fn

This commit is contained in:
2026-01-18 10:35:05 -06:00
parent e695810e64
commit 98cb2c3239
31 changed files with 184 additions and 185 deletions

View File

@@ -20,7 +20,7 @@ var target_triple = null
var follow_links = false
// Parse arguments
for (var i = 0; i < args.length; i++) {
for (var i = 0; i < length(args); i++) {
if (args[i] == '--help' || args[i] == '-h') {
log.console("Usage: cell update [<locator>] [options]")
log.console("")
@@ -34,7 +34,7 @@ for (var i = 0; i < args.length; i++) {
} else if (args[i] == '--build') {
run_build = true
} else if (args[i] == '--target' || args[i] == '-t') {
if (i + 1 < args.length) {
if (i + 1 < length(args)) {
target_triple = args[++i]
} else {
log.error('--target requires a triple')
@@ -107,10 +107,10 @@ if (target_pkg) {
}
} else {
var packages = shop.list_packages()
var pkg_count = packages.length
var pkg_count = length(packages)
log.console("Checking for updates (" + text(pkg_count) + " package" + (pkg_count == 1 ? "" : "s") + ")...")
for (var i = 0; i < packages.length; i++) {
for (var i = 0; i < length(packages); i++) {
var pkg = packages[i]
if (pkg == 'core') continue
@@ -120,15 +120,15 @@ if (target_pkg) {
}
}
if (updated_packages.length > 0) {
log.console("Updated " + text(updated_packages.length) + " package" + (updated_packages.length == 1 ? "" : "s") + ".")
if (length(updated_packages)) > 0) {
log.console("Updated " + text(length(updated_packages)) + " package" + (length(updated_packages) == 1 ? "" : "s") + ".")
} else {
log.console("All packages are up to date.")
}
}
// Run build if requested
if (run_build && updated_packages.length > 0) {
if (run_build && length(updated_packages) > 0) {
log.console("")
log.console("Building updated packages...")