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

18
list.ce
View File

@@ -13,7 +13,7 @@ var fd = use('fd')
var mode = 'local'
var target_pkg = null
if (args && args.length > 0) {
if (args && length(args) > 0) {
if (args[0] == 'shop') {
mode = 'shop'
} else if (args[0] == '--help' || args[0] == '-h') {
@@ -62,12 +62,12 @@ function print_deps(ctx, indent) {
for (var k in deps) aliases.push(k)
aliases = sort(aliases)
if (aliases.length == 0) {
if (length(aliases) == 0) {
log.console(indent + " (none)")
return
}
for (var i = 0; i < aliases.length; i++) {
for (var i = 0; i < length(aliases); i++) {
var alias = aliases[i]
var locator = deps[alias]
var link_target = links[locator]
@@ -93,7 +93,7 @@ function print_deps(ctx, indent) {
status.push("not installed")
}
if (status.length > 0) {
if (length(status) > 0) {
line += " [" + text(status, ", ") + "]"
}
@@ -112,7 +112,7 @@ if (mode == 'local') {
log.console("")
var packages = shop.list_packages()
if (packages.length == 0) {
if (length(packages) == 0) {
log.console(" (none)")
} else {
packages = sort(packages)
@@ -136,7 +136,7 @@ if (mode == 'local') {
}
})
if (linked_pkgs.length > 0) {
if (length(linked_pkgs) > 0) {
log.console("Linked packages:")
arrfor(linked_pkgs, function(p) {
var target = links[p]
@@ -145,7 +145,7 @@ if (mode == 'local') {
log.console("")
}
if (local_pkgs.length > 0) {
if (length(local_pkgs) > 0) {
log.console("Local packages:")
arrfor(local_pkgs, function(p) {
log.console(" " + p)
@@ -153,7 +153,7 @@ if (mode == 'local') {
log.console("")
}
if (remote_pkgs.length > 0) {
if (length(remote_pkgs) > 0) {
log.console("Remote packages:")
arrfor(remote_pkgs, function(p) {
var lock_entry = lock[p]
@@ -163,7 +163,7 @@ if (mode == 'local') {
log.console("")
}
log.console("Total: " + text(packages.length) + " package(s)")
log.console("Total: " + text(length(packages)) + " package(s)")
}
}