@heroku-cli/command
Version:
base class for Heroku CLI commands
15 lines (14 loc) • 435 B
JavaScript
import { execSync } from 'node:child_process';
function toggle(onoff) {
if (yubikey.platform !== 'darwin')
return;
try {
execSync(`osascript -e 'if application "yubiswitch" is running then tell application "yubiswitch" to ${onoff}'`, { stdio: 'inherit' });
}
catch { }
}
export const yubikey = {
disable: () => toggle('KeyOff'),
enable: () => toggle('KeyOn'),
platform: process.platform,
};