You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
import { execSync } from 'child_process' |
|
import { lsFolder } from '../files.js' |
|
export const ALCHEMY_FOLDER = process.env.HOME + '/Alchemy' |
|
|
|
function statusAlchemy() { |
|
return lsFolder(ALCHEMY_FOLDER).length >= 6 ? 'installed' : 'off' |
|
} |
|
|
|
function downloadAlchemy() { |
|
console.log('Beacon of Zen') |
|
} |
|
|
|
function updateAlchemy() { |
|
try { |
|
const result = execSync('cd ~/Alchemy && git pull') |
|
if(result.toString().includes('Already up to date.')) { |
|
console.log('Alchemy is already up to date.') |
|
} else { |
|
console.log('Alchemy updated.') |
|
return true |
|
} |
|
} catch(error) { |
|
console.log('Failed to update Alchemy scripts: ', error) |
|
} |
|
return false |
|
} |
|
|
|
function onMyCustomMenuItem() { |
|
console.log("Not implemented.") |
|
} |
|
|
|
export default { |
|
name: 'Alchemy', |
|
description: 'scripts that transmute your system into gold', |
|
status: statusAlchemy, |
|
install: downloadAlchemy, |
|
update: updateAlchemy, |
|
// These menu items will show up oin Features->Alchemy. The key/(menu:value:) is arbitrary but must be the same in both places. |
|
custom_script_1: onMyCustomMenuItem, |
|
menu: [ |
|
{ name: 'Menu item to trigger a very specific Alchemy script', value: 'custom_script_1' } |
|
] |
|
}
|
|
|