local B=require("yaru.backuplib") local args,opts=require("shell").parse(...) local cfg=B.config() if not cfg.dst then io.stderr:write("backup: no destination set (open the Backups app)\n")return 1 end if opts.list then for _,s in ipairs(B.snapshots(cfg.dst))do local i=B.info(cfg.dst,s)print(s,(i.files or"?").." files")end return end local stamp=os.date("%Y-%m-%d_%H%M%S") local n,b=B.run(cfg,nil,stamp) if not n then io.stderr:write("backup failed: "..tostring(b).."\n")return 1 end print(string.format("backup %s: %d files, %d bytes",stamp,n,b)) local core=package.loaded["yaru.core"] if core and core.running then core.notify("Backup finished",n.." files saved")end