Skip to content

Commit

Permalink
Fix dotfile ignore regression in addCommandDir
Browse files Browse the repository at this point in the history
  • Loading branch information
eritbh committed Oct 10, 2020
1 parent 2b40a73 commit 6547954
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,22 @@ export class Client extends Eris.Client implements ClientOptions {
return this;
}

/** Load the files in a directory and attempt to add a command from each. */
/**
* Load the files in a directory and attempt to add a command from each.
* Searches recursively through directories, but ignores files and nested
* directories whose names begin with a period.
*/
addCommandDir (dirname: string): this {
// Synchronous calls are fine with this method because it's only called
// on init
// eslint-disable-next-line no-sync
const filenames = fs.readdirSync(dirname);
for (const filename of filenames) {
// ignore files/directories that are disabled with a leading dot
if (filename.startsWith('.')) {
continue;
}

const filepath = path.resolve(dirname, filename);
// eslint-disable-next-line no-sync
const info = fs.statSync(filepath);
Expand Down

0 comments on commit 6547954

Please sign in to comment.