fix: cas has now returns exit 1 for non-existent hashes

Changed the exit behavior of 'uwf cas has' to return exit code 1 when
a hash doesn't exist, while preserving the JSON output {exists:false}.
This enables proper use in shell conditionals like 'if uwf cas has $HASH'.

Fixes #481
This commit is contained in:
2026-05-25 00:47:39 +00:00
parent 92f3b36b10
commit 984e6ae56d
3 changed files with 231 additions and 1 deletions
+5 -1
View File
@@ -549,7 +549,11 @@ cas
.action((hash: string) => {
const storageRoot = resolveStorageRoot();
runAction(async () => {
writeOutput(await cmdCasHas(storageRoot, hash));
const result = await cmdCasHas(storageRoot, hash);
writeOutput(result);
if (!result.exists) {
process.exit(1);
}
});
});