better commands

This commit is contained in:
2025-12-27 13:51:11 -06:00
parent c8831c85d0
commit 4f076bc868
10 changed files with 382 additions and 24 deletions

View File

@@ -9,6 +9,7 @@
// cell update <package> - Update a specific package
var shop = use('internal/shop')
var fd = use('fd')
var target_pkg = null
@@ -26,6 +27,13 @@ for (var i = 0; i < args.length; i++) {
$stop()
} else if (!args[i].startsWith('-')) {
target_pkg = args[i]
// Resolve relative paths to absolute paths
if (target_pkg == '.' || target_pkg.startsWith('./') || target_pkg.startsWith('../') || fd.is_dir(target_pkg)) {
var resolved = fd.realpath(target_pkg)
if (resolved) {
target_pkg = resolved
}
}
}
}
@@ -37,9 +45,16 @@ function update_and_fetch(pkg)
var new_entry = shop.update(pkg)
if (new_entry && new_entry.commit) {
log.console(" " + pkg + " " + old_commit.substring(0, 8) + " -> " + new_entry.commit.substring(0, 8))
shop.fetch(pkg)
if (new_entry) {
if (new_entry.commit) {
var old_str = old_commit ? old_commit.substring(0, 8) : "(new)"
log.console(" " + pkg + " " + old_str + " -> " + new_entry.commit.substring(0, 8))
shop.fetch(pkg)
} else {
// Local package - just ensure symlink is correct
log.console(" " + pkg + " (local)")
}
shop.extract(pkg)
shop.build_package_scripts(pkg)
return true
}