19 lines
526 B
Plaintext
19 lines
526 B
Plaintext
/** Shared helpers for drive-resident /bin scripts (prepended before each command). */
|
|
function bareStdin(ctx) {
|
|
return typeof ctx.shellStdin === 'string' ? ctx.shellStdin : ''
|
|
}
|
|
|
|
async function run(ctx, argv) {
|
|
const save = argv.includes('--save')
|
|
const logout = ctx.applyLogout
|
|
if (typeof logout !== 'function') {
|
|
ctx.console.error('logout: not supported in this environment')
|
|
return
|
|
}
|
|
try {
|
|
await logout.call(ctx, { save })
|
|
} catch (err) {
|
|
ctx.console.error(err?.message ?? String(err))
|
|
}
|
|
}
|