@prana-w/btw
Version:
btw_cli (btw: by-the-W) is a simple and powerful Command Line Interface (CLI) designed to help you perform various useful tasks directly from your terminal.
23 lines (18 loc) • 580 B
JavaScript
import open from 'open';
import linkStore from '../../config/linkStore.js';
export default function openLink(name) {
const quickLinks = linkStore.get('quickLink') || [];
const requiredLink = (quickLinks &&
quickLinks.filter((link) => link.name === name))[0]?.url;
if (!requiredLink) {
console.error('Not Found!');
return;
}
open(requiredLink)
.then(() => {
console.log(`Opened ${name} successfully!`);
})
.catch((error) => {
console.error('Error opening link:', error);
});
}