You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So your two functions should be like this (Might as well copy and paste this code lol)
functiongetCurrentTheme(themesFolder){if(!alacrittyConfigPath()){console.log('No Alacritty configuration file found\nRun: `alacritty-themes -C` to create one');exit(1);}constalacrittyConfig=fs.readFileSync(alacrittyConfigPath(),'utf8');constparsedAlacrittyConfig=TOML.parse(alacrittyConfig);constimports=parsedAlacrittyConfig.general?.import||[];// We'll consider the first theme import as the current themefor(leti=0;i<imports.length;i++){constrelative=path.relative(themesFolder,imports[i]);if(relative&&!relative.startsWith('..')&&!path.isAbsolute(relative)){returnpath.parse(imports[i]).name;}}return'default';}functionupdateThemeWithFile(themePath,themesPath,tomlPath,preview=false){constalacrittyConfig=fs.readFileSync(tomlPath,'utf8');constparsedAlacrittyConfig=TOML.parse(alacrittyConfig);constimports=parsedAlacrittyConfig.general?.import||[];letcurrentThemeIndex=undefined;for(leti=0;i<imports.length;i++){constrelative=path.relative(themesPath,imports[i]);if(relative&&!relative.startsWith('..')&&!path.isAbsolute(relative)){currentThemeIndex=i;break;}}if(currentThemeIndex===undefined){parsedAlacrittyConfig.general=parsedAlacrittyConfig.general||{};parsedAlacrittyConfig.general.import=[themePath];}else{parsedAlacrittyConfig.general.import[currentThemeIndex]=themePath;}constnewContent=TOML.stringify(parsedAlacrittyConfig);constthemeName=path.parse(themePath).name;returnfsPromises.writeFile(tomlPath,newContent,'utf8').then(()=>{if(!preview){console.log(`The theme "${themeName}" has been applied successfully!`);}}).catch((err)=>{if(err)throwerr;});}
Describe the bug
After alacritty update to 0.14.0 import=[] is deprecated, alacritty-themes need to set [general] and then import=[] in config file
To Reproduce
Steps to reproduce the behavior:
Expected behavior
alacritty-themes successfully adds to the config file:
But it should add:
Operating System:
Add your alacritty.yml content
it's toml btw:
Screenshots
The text was updated successfully, but these errors were encountered: