UNPKG

linear-cmd

Version:

A GitHub CLI-like tool for Linear - manage issues, accounts, and more

47 lines (46 loc) 1.14 kB
import { platform } from 'node:os'; export function isWindows() { return platform() === 'win32'; } export function isMac() { return platform() === 'darwin'; } export function isLinux() { return platform() === 'linux'; } export function detectShell() { if (isWindows()) { const comspec = process.env.COMSPEC || ''; const psModulePath = process.env.PSModulePath || ''; if (psModulePath) { return 'powershell'; } if (comspec.includes('cmd.exe')) { return 'cmd'; } return null; } const currentShell = process.env.SHELL || ''; if (currentShell.includes('zsh')) { return 'zsh'; } if (currentShell.includes('bash')) { return 'bash'; } return null; } export function getShellRestartCommand(shell) { if (shell === 'zsh') { return 'exec zsh'; } if (shell === 'bash') { return 'exec bash'; } if (shell === 'powershell') { return '& $PROFILE'; } if (shell === 'cmd') { return 'Restart your terminal'; } return 'Restart your shell or terminal'; }