// Name: Clear Powershell History// Description: Clear powershell history file on windows// Author: Ricardo Gonçalves Basseteimport "@johnlindquist/kit"const filePath = home('AppData', 'Roaming', 'Microsoft', 'Windows', 'PowerShell', 'PSReadline', 'ConsoleHost_history.txt')writeFile(filePath, '')
// Name: Chmod Calculator// Description: Asks the user what permissions to grant to a file/folder and creates a chmod command with those permissions// Author: Ricardo Gonçalves Basseteimport "@johnlindquist/kit"const permissions = ['read', 'write', 'execute']function getValue(permissions: string[]) {const r = permissions.includes('read') ? 4 : 0const w = permissions.includes('write') ? 2 : 0const x = permissions.includes('execute') ? 1 : 0return r+w+x}const ownerPermissions: string[] = await select({placeholder: 'Owner permissions',alwaysOnTop: true,strict: true,}, permissions)const groupPermissions: string[] = await select({placeholder: 'Group permissions',alwaysOnTop: true,strict: true,}, permissions)const publicPermissions: string[] = await select({placeholder: 'Public permissions',alwaysOnTop: true,strict: true,}, permissions)const command = `chmod ${getValue(ownerPermissions)}${getValue(groupPermissions)}${getValue(publicPermissions)}`setSelectedText(command)
// Name: Clear Downloads Folder// Description: Lists files and folders within your downloads folder and asks which items you want to remove// Author: Ricardo Gonçalves Basseteimport "@johnlindquist/kit"const downloadsFolder = home('Downloads')const items = await readdir(downloadsFolder)const itemsToRemove: string[] = await select({placeholder: 'Select the items you want to remove',alwaysOnTop: true,strict: true,}, items)const wishToRemove = await arg({placeholder: 'This will remove all selected items, do you want to continue?',choices: [{ name: 'Yes', value: true },{ name: 'No', value: false }],strict: true})if(wishToRemove) {itemsToRemove.forEach(item => {const itemPath = path.resolve(downloadsFolder, item)remove(itemPath)})}