Skip to content

Commit 1bb4289

Browse files
authored
refactor: rename "blacklist" -> "blocklist" (#193)
No change to logic. This just renames "blacklist" to "blocklist" to use more inclusive language. Test: npm run test Test: ./lib/cli.js exec (this is blocked, as expected) Test: ./lib/cli.js help (does not mention blocked commands)
1 parent 009e7bb commit 1bb4289

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const EXIT_CODES = {
66
SUCCESS: 0,
77
};
88

9-
export const CMD_BLACKLIST = [
9+
export const CMD_BLOCKLIST = [
1010
'cd',
1111
'pushd',
1212
'popd',
@@ -17,7 +17,7 @@ export const CMD_BLACKLIST = [
1717
'ShellString',
1818
];
1919

20-
export const OPTION_BLACKLIST = [
20+
export const OPTION_BLOCKLIST = [
2121
'globOptions', // we don't have good control over globbing in the shell
2222
'execPath', // we don't currently support exec
2323
'bufLength', // we don't use buffers in shx

src/help.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import shell from 'shelljs';
2-
import { CMD_BLACKLIST, OPTION_BLACKLIST } from './config';
2+
import { CMD_BLOCKLIST, OPTION_BLOCKLIST } from './config';
33

44
// Global options defined directly in shx.
55
const locallyDefinedOptions = ['version'];
66

77
const shxOptions = Object.keys(shell.config)
88
.filter(key => typeof shell.config[key] !== 'function')
9-
.filter(key => OPTION_BLACKLIST.indexOf(key) === -1)
9+
.filter(key => OPTION_BLOCKLIST.indexOf(key) === -1)
1010
.concat(locallyDefinedOptions)
1111
.map(key => ` * --${key}`);
1212

1313
export default () => {
1414
// Note: compute this at runtime so that we have all plugins loaded.
1515
const commandList = Object.keys(shell)
1616
.filter(cmd => typeof shell[cmd] === 'function')
17-
.filter(cmd => CMD_BLACKLIST.indexOf(cmd) === -1)
17+
.filter(cmd => CMD_BLOCKLIST.indexOf(cmd) === -1)
1818
.map(cmd => ` * ${cmd}`);
1919

2020
return `

src/shx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import minimist from 'minimist';
33
import path from 'path';
44
import fs from 'fs';
55
import help from './help';
6-
import { CMD_BLACKLIST, EXIT_CODES, CONFIG_FILE } from './config';
6+
import { CMD_BLOCKLIST, EXIT_CODES, CONFIG_FILE } from './config';
77
import { printCmdRet } from './printCmdRet';
88

99
shell.help = help;
@@ -81,7 +81,7 @@ export function shx(argv) {
8181
console.error(`Error: Invalid ShellJS command: ${fnName}.`);
8282
console.error(help());
8383
return EXIT_CODES.SHX_ERROR;
84-
} else if (CMD_BLACKLIST.indexOf(fnName) > -1) {
84+
} else if (CMD_BLOCKLIST.indexOf(fnName) > -1) {
8585
console.error(`Warning: shx ${fnName} is not supported`);
8686
console.error('Please run `shx help` for a list of commands.');
8787
return EXIT_CODES.SHX_ERROR;

test/specs/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('cli', () => {
7373
output.code.should.equal(EXIT_CODES.SHX_ERROR);
7474
});
7575

76-
it('fails for blacklisted commands', () => {
76+
it('fails for blocked commands', () => {
7777
const output = cli('cd', 'src');
7878
output.stdout.should.equal('');
7979
output.stderr.should.match(/Warning: shx cd is not supported\n/);

0 commit comments

Comments
 (0)