Files
cell/fetch.ce
2026-02-20 14:44:48 -06:00

47 lines
1.2 KiB
Plaintext

// cell fetch - Sync packages from remote sources
//
// Ensures all packages are fetched, extracted, compiled, and ready to use.
// For local packages, this is a no-op (symlinks only).
//
// Usage:
// cell fetch - Sync all packages
// cell fetch <package> - Sync a specific package
var shop = use('internal/shop')
var target_pkg = null
var i = 0
var packages = null
var count = 0
for (i = 0; i < length(args); i++) {
if (args[i] == '--help' || args[i] == '-h') {
log.console("Usage: cell fetch [package]")
log.console("Sync packages from remote sources.")
log.console("")
log.console("Arguments:")
log.console(" package Optional package to sync. If omitted, syncs all.")
$stop()
} else if (!starts_with(args[i], '-')) {
target_pkg = args[i]
}
}
if (target_pkg) {
target_pkg = shop.resolve_locator(target_pkg)
log.console("Syncing " + target_pkg + "...")
shop.sync(target_pkg)
log.console("Done.")
} else {
packages = shop.list_packages()
count = 0
arrfor(packages, function(pkg) {
if (pkg == 'core') return
shop.sync(pkg)
count = count + 1
})
log.console("Synced " + text(count) + " package(s).")
}
$stop()