Skip to content

Commit

Permalink
fix: check if alacrittyConfigPath is undefined before reading the file (
Browse files Browse the repository at this point in the history
  • Loading branch information
mesalilac authored Nov 27, 2021
1 parent c727b61 commit afd82eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Themes :candy: for [alacritty](https://github.com/alacritty/alacritty) A cross-p
To find the list of themes, you can visit the alacritty [wiki page](https://github.com/alacritty/alacritty/wiki/Color-schemes)

- Live preview the themes
- 150+ Themes to choose from
- 200+ Themes to choose from
- Apply any theme with just one command at the terminal
- Option to create your `alacritty.yml` config file
- Simple, Easy and intuitive User experience
Expand Down
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
pathToAlacrittyFile,
themeFilePath,
} = require('./src/helpers');
const { exit } = require('process');

// pick the correct config file or handle errors, if it doesn't exist
function getAlacrittyConfig() {
Expand Down Expand Up @@ -45,6 +46,12 @@ function createConfigFile() {
}

function getCurrentTheme() {
if (!alacrittyConfigPath()) {
console.log(
'No Alacritty configuration file found\nRun: `alacritty-themes -C` to create one'
);
exit(1);
}
const themeFile = fs.readFileSync(alacrittyConfigPath(), 'utf8');
const themeDoc = YAML.parse(themeFile);

Expand Down

0 comments on commit afd82eb

Please sign in to comment.