find-cli 1.7.4 → 1.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/.swcrc +5 -0
  2. package/find.js +3 -3
  3. package/lib/abbreviations.js +26 -0
  4. package/lib/action/addRootDirectoryPath.js +38 -0
  5. package/lib/action/find.js +73 -0
  6. package/lib/action/help.js +15 -0
  7. package/lib/action/initialise.js +23 -0
  8. package/lib/action/listRootDirectoryPaths.js +27 -0
  9. package/lib/action/removeRootDirectoryPath.js +39 -0
  10. package/lib/action/version.js +19 -0
  11. package/lib/commands.js +42 -0
  12. package/lib/configuration/version_1_1.js +25 -0
  13. package/lib/configuration/version_1_2.js +42 -0
  14. package/lib/configuration/version_1_3.js +24 -0
  15. package/lib/configuration/version_1_4.js +29 -0
  16. package/lib/configuration/version_1_7.js +44 -0
  17. package/lib/configuration.js +216 -0
  18. package/lib/constants.js +58 -0
  19. package/lib/converter/alternates.js +135 -0
  20. package/lib/converter/characterClass.js +148 -0
  21. package/lib/converter/default.js +131 -0
  22. package/lib/converter/directory.js +131 -0
  23. package/lib/converter/escapedCharacter.js +131 -0
  24. package/lib/converter/period.js +131 -0
  25. package/lib/converter/questionMark.js +131 -0
  26. package/lib/converter/repeatedDirectories.js +131 -0
  27. package/lib/converter/repeatedWildcard.js +131 -0
  28. package/lib/converter/singleDirectory.js +131 -0
  29. package/lib/converter/singleWildcard.js +131 -0
  30. package/lib/converter.js +71 -0
  31. package/lib/converters.js +42 -0
  32. package/lib/defaults.js +50 -0
  33. package/lib/descriptions.js +30 -0
  34. package/lib/find.js +53 -0
  35. package/lib/isIgnored/asynchronous.js +61 -0
  36. package/lib/isIgnored/synchronous.js +83 -0
  37. package/lib/line.js +196 -0
  38. package/lib/main.js +89 -0
  39. package/lib/messages.js +74 -0
  40. package/lib/occurrence.js +69 -0
  41. package/lib/operation/addRootDirectoryPath.js +19 -0
  42. package/lib/operation/find.js +69 -0
  43. package/lib/operation/listRootDirectoryPaths.js +38 -0
  44. package/lib/operation/previousRule.js +34 -0
  45. package/lib/operation/prompt/addRootDirectoryPath.js +41 -0
  46. package/lib/operation/prompt/ignoreOrPermitPath.js +37 -0
  47. package/lib/operation/prompt/pathRule.js +41 -0
  48. package/lib/operation/prompt/previousRule.js +44 -0
  49. package/lib/operation/prompt/removeRootDirectoryPath.js +50 -0
  50. package/lib/operation/prompt/rule.js +60 -0
  51. package/lib/operation/removeRootDirectoryPath.js +28 -0
  52. package/lib/operation/removeRootDirectoryPathByIndex.js +35 -0
  53. package/lib/operation/rule.js +34 -0
  54. package/lib/operation/updatePatRules.js +40 -0
  55. package/lib/operation/validateRootDirectoryPath.js +30 -0
  56. package/lib/options.js +54 -0
  57. package/lib/prepare.js +37 -0
  58. package/lib/rule/glob.js +223 -0
  59. package/lib/rule/regex.js +171 -0
  60. package/lib/rule/string.js +154 -0
  61. package/lib/types.js +26 -0
  62. package/lib/utilities/find.js +140 -0
  63. package/lib/utilities/literal.js +33 -0
  64. package/lib/utilities/log.js +45 -0
  65. package/lib/utilities/operation.js +32 -0
  66. package/lib/utilities/path.js +53 -0
  67. package/lib/utilities/prompt.js +97 -0
  68. package/lib/utilities/rule.js +17 -0
  69. package/lib/utilities/string.js +69 -0
  70. package/lib/utilities/validate.js +58 -0
  71. package/lib/versions.js +38 -0
  72. package/package.json +21 -6
  73. package/{bin → src}/abbreviations.js +3 -1
  74. package/src/action/addRootDirectoryPath.js +29 -0
  75. package/{bin → src}/action/find.js +8 -10
  76. package/{bin → src}/action/help.js +1 -3
  77. package/{bin → src}/action/initialise.js +3 -5
  78. package/src/action/listRootDirectoryPaths.js +16 -0
  79. package/src/action/removeRootDirectoryPath.js +31 -0
  80. package/src/action/version.js +13 -0
  81. package/src/commands.js +9 -0
  82. package/{bin → src}/configuration/version_1_1.js +2 -6
  83. package/{bin → src}/configuration/version_1_2.js +3 -7
  84. package/src/configuration/version_1_3.js +18 -0
  85. package/{bin → src}/configuration/version_1_4.js +2 -6
  86. package/{bin → src}/configuration/version_1_7.js +4 -9
  87. package/{bin → src}/configuration.js +15 -15
  88. package/src/constants.js +13 -0
  89. package/{bin → src}/converter/alternates.js +3 -3
  90. package/{bin → src}/converter/characterClass.js +3 -3
  91. package/{bin → src}/converter/default.js +2 -2
  92. package/{bin → src}/converter/directory.js +2 -2
  93. package/{bin → src}/converter/escapedCharacter.js +2 -2
  94. package/{bin → src}/converter/period.js +2 -2
  95. package/{bin → src}/converter/questionMark.js +2 -2
  96. package/{bin → src}/converter/repeatedDirectories.js +2 -2
  97. package/{bin → src}/converter/repeatedWildcard.js +2 -2
  98. package/{bin → src}/converter/singleDirectory.js +2 -2
  99. package/{bin → src}/converter/singleWildcard.js +2 -2
  100. package/{bin → src}/converter.js +3 -5
  101. package/src/converters.js +29 -0
  102. package/src/defaults.js +11 -0
  103. package/src/descriptions.js +6 -0
  104. package/{bin → src}/find.js +3 -5
  105. package/{bin → src}/isIgnored/asynchronous.js +7 -12
  106. package/{bin → src}/isIgnored/synchronous.js +5 -10
  107. package/{bin → src}/line.js +4 -6
  108. package/{bin → src}/main.js +19 -21
  109. package/src/messages.js +17 -0
  110. package/{bin → src}/occurrence.js +2 -4
  111. package/{bin → src}/operation/addRootDirectoryPath.js +2 -4
  112. package/{bin → src}/operation/find.js +8 -10
  113. package/{bin → src}/operation/listRootDirectoryPaths.js +4 -10
  114. package/{bin → src}/operation/previousRule.js +3 -5
  115. package/{bin → src}/operation/prompt/addRootDirectoryPath.js +5 -7
  116. package/{bin → src}/operation/prompt/ignoreOrPermitPath.js +6 -8
  117. package/{bin → src}/operation/prompt/pathRule.js +6 -8
  118. package/{bin → src}/operation/prompt/previousRule.js +4 -6
  119. package/{bin → src}/operation/prompt/removeRootDirectoryPath.js +6 -8
  120. package/{bin → src}/operation/prompt/rule.js +7 -9
  121. package/{bin → src}/operation/removeRootDirectoryPath.js +3 -5
  122. package/{bin → src}/operation/removeRootDirectoryPathByIndex.js +3 -9
  123. package/{bin → src}/operation/rule.js +2 -4
  124. package/{bin → src}/operation/updatePatRules.js +3 -5
  125. package/{bin → src}/operation/validateRootDirectoryPath.js +3 -5
  126. package/src/options.js +12 -0
  127. package/{bin → src}/prepare.js +11 -13
  128. package/{bin → src}/rule/glob.js +7 -9
  129. package/{bin → src}/rule/regex.js +12 -14
  130. package/{bin → src}/rule/string.js +5 -7
  131. package/src/types.js +5 -0
  132. package/{bin → src}/utilities/find.js +7 -11
  133. package/src/utilities/literal.js +13 -0
  134. package/src/utilities/log.js +18 -0
  135. package/{bin → src}/utilities/operation.js +2 -6
  136. package/{bin → src}/utilities/path.js +5 -11
  137. package/{bin → src}/utilities/prompt.js +5 -10
  138. package/{bin → src}/utilities/rule.js +1 -5
  139. package/src/utilities/string.js +21 -0
  140. package/{bin → src}/utilities/validate.js +5 -12
  141. package/src/versions.js +8 -0
  142. package/bin/action/addRootDirectoryPath.js +0 -31
  143. package/bin/action/listRootDirectoryPaths.js +0 -18
  144. package/bin/action/removeRootDirectoryPath.js +0 -33
  145. package/bin/action/version.js +0 -15
  146. package/bin/commands.js +0 -19
  147. package/bin/configuration/version_1_3.js +0 -22
  148. package/bin/constants.js +0 -27
  149. package/bin/converters.js +0 -29
  150. package/bin/defaults.js +0 -23
  151. package/bin/descriptions.js +0 -13
  152. package/bin/messages.js +0 -35
  153. package/bin/options.js +0 -25
  154. package/bin/types.js +0 -11
  155. package/bin/utilities/literal.js +0 -19
  156. package/bin/utilities/log.js +0 -26
  157. package/bin/utilities/string.js +0 -33
  158. package/bin/versions.js +0 -17
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- const { encodings, characters } = require("necessary");
3
+ import { encodings, characters } from "necessary";
4
4
 
5
- const { DATA } = require("../constants"),
6
- { PREVIOUS_GLOB_STRING_OR_REGEX_DESCRIPTION } = require("../descriptions");
5
+ import { DATA } from "../constants";
6
+ import { PREVIOUS_GLOB_STRING_OR_REGEX_DESCRIPTION } from "../descriptions";
7
7
 
8
8
  const { UTF8_ENCODING } = encodings,
9
9
  { UP_CHARACTER,
@@ -14,9 +14,9 @@ const { UTF8_ENCODING } = encodings,
14
14
  NEW_LINE_CHARACTER,
15
15
  CARRIAGE_RETURN_CHARACTER } = characters;
16
16
 
17
- function isAnswerIgnore(answer) { return /^(:?ignore|i)$/i.test(answer); }
17
+ export function isAnswerIgnore(answer) { return /^(:?ignore|i)$/i.test(answer); }
18
18
 
19
- function selectPreviousRule(previousRules, callback) {
19
+ export function selectPreviousRule(previousRules, callback) {
20
20
  let index = 0,
21
21
  previousRule = previousRules[index];
22
22
 
@@ -112,11 +112,6 @@ function selectPreviousRule(previousRules, callback) {
112
112
  }
113
113
  }
114
114
 
115
- module.exports = {
116
- isAnswerIgnore,
117
- selectPreviousRule
118
- };
119
-
120
115
  function writePreviousRule(previousRule) {
121
116
  const description = PREVIOUS_GLOB_STRING_OR_REGEX_DESCRIPTION, ///
122
117
  previousRuleString = previousRule.asString();
@@ -4,7 +4,7 @@ const GlobRule = require("../rule/glob"),
4
4
  RegexRule = require("../rule/regex"),
5
5
  StringRule = require("../rule/string");
6
6
 
7
- function ruleFromStringAnchoredAndDirectory(string, anchored, directory) {
7
+ export function ruleFromStringAnchoredAndDirectory(string, anchored, directory) {
8
8
  const globRule = GlobRule.fromStringAnchoredAndDirectory(string, anchored, directory),
9
9
  regexRule = RegexRule.fromStringAnchoredAndDirectory(string, anchored, directory),
10
10
  stringRule = StringRule.fromStringAnchoredAndDirectory(string, anchored, directory),
@@ -12,7 +12,3 @@ function ruleFromStringAnchoredAndDirectory(string, anchored, directory) {
12
12
 
13
13
  return rule;
14
14
  }
15
-
16
- module.exports = {
17
- ruleFromStringAnchoredAndDirectory
18
- };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ import { EMPTY_STRING } from "../constants";
4
+
5
+ export function addAnchors(string) { return `^${string}$`; }
6
+
7
+ export function removeAnchors(string) { return string.replace(/(^\^|\$$)/g, EMPTY_STRING); }
8
+
9
+ export function addForwardSlashes(string) { return `/${string}/`; }
10
+
11
+ export function removeDoubleQuotes(string) { return string.replace(/(^"|"$)/g, EMPTY_STRING); }
12
+
13
+ export function removeForwardSlashes(string) { return string.replace(/(^\/|\/$)/g, EMPTY_STRING); }
14
+
15
+ export function addTrailingForwardSlash(string) { return `${string}\/`; }
16
+
17
+ export function removeTrailingForwardSlash(string) { return string.replace(/(\/$)/, EMPTY_STRING); }
18
+
19
+ export function addTrailingEscapedForwardSlash(string) { return `${string}\\\/`; }
20
+
21
+ export function removeTrailingEscapedForwardSlash(string) { return string.replace(/(\\\/$)/, EMPTY_STRING); }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- const { ruleFromStringAnchoredAndDirectory } = require("../utilities/rule");
3
+ import { ruleFromStringAnchoredAndDirectory } from "../utilities/rule";
4
4
 
5
- function validateIndex(answer, lastIndex) {
5
+ export function validateIndex(answer, lastIndex) {
6
6
  let valid = true;
7
7
 
8
8
  if (valid) {
@@ -18,9 +18,9 @@ function validateIndex(answer, lastIndex) {
18
18
  return valid;
19
19
  }
20
20
 
21
- function validateIgnoreOrPermit(answer) { return /^(:?ignore|permit|i|p)$/i.test(answer); }
21
+ export function validateIgnoreOrPermit(answer) { return /^(:?ignore|permit|i|p)$/i.test(answer); }
22
22
 
23
- function validateRootDirectoryPath(answer) {
23
+ export function validateRootDirectoryPath(answer) {
24
24
  let valid = true;
25
25
 
26
26
  if (valid) {
@@ -39,17 +39,10 @@ function validateRootDirectoryPath(answer) {
39
39
  return valid;
40
40
  }
41
41
 
42
- function validateGlobStringOrPattern(answer, anchored, directory) {
42
+ export function validateGlobStringOrPattern(answer, anchored, directory) {
43
43
  const string = answer, ///
44
44
  rule = ruleFromStringAnchoredAndDirectory(string, anchored, directory),
45
45
  valid = (rule !== null)
46
46
 
47
47
  return valid;
48
48
  }
49
-
50
- module.exports = {
51
- validateIndex,
52
- validateIgnoreOrPermit,
53
- validateRootDirectoryPath,
54
- validateGlobStringOrPattern
55
- };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ export const VERSION_1_0 = "1.0";
4
+ export const VERSION_1_1 = "1.1";
5
+ export const VERSION_1_2 = "1.2";
6
+ export const VERSION_1_3 = "1.3";
7
+ export const VERSION_1_4 = "1.4";
8
+ export const VERSION_1_7 = "1.7";
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- const addRootDirectoryPathOperation = require("../operation/addRootDirectoryPath"),
4
- validateRootDirectoryPathOperation = require("../operation/validateRootDirectoryPath"),
5
- addRootDirectoryPathPromptOperation = require("../operation/prompt/addRootDirectoryPath");
6
-
7
- const { executeOperations } = require("../utilities/operation"),
8
- { FAILED_ADD_ROOT_DIRECTORY_MESSAGE, SUCCESSFUL_ADD_ROOT_DIRECTORY_MESSAGE } = require("../messages");
9
-
10
- function addRootDirectoryPathAction(rootDirectoryPath) {
11
- const operations = [
12
- validateRootDirectoryPathOperation,
13
- addRootDirectoryPathPromptOperation,
14
- addRootDirectoryPathOperation
15
- ],
16
- context = {
17
- rootDirectoryPath
18
- };
19
-
20
- executeOperations(operations, (completed) => {
21
- if (!completed) {
22
- console.log(FAILED_ADD_ROOT_DIRECTORY_MESSAGE);
23
-
24
- return;
25
- }
26
-
27
- console.log(SUCCESSFUL_ADD_ROOT_DIRECTORY_MESSAGE);
28
- }, context);
29
- }
30
-
31
- module.exports = addRootDirectoryPathAction;
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- const listRootDirectoryPathsOperation = require("../operation/listRootDirectoryPaths");
4
-
5
- const { executeOperations } = require("../utilities/operation");
6
-
7
- function listRootDirectoryPathsAction() {
8
- const operations = [
9
- listRootDirectoryPathsOperation
10
- ],
11
- context = {};
12
-
13
- executeOperations(operations, (completed) => {
14
- ///
15
- }, context);
16
- }
17
-
18
- module.exports = listRootDirectoryPathsAction;
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- const removeRootDirectoryPathOperation = require("../operation/removeRootDirectoryPath"),
4
- removeRootDirectoryPathPromptOperation = require("../operation/prompt/removeRootDirectoryPath"),
5
- removeRootDirectoryPathByIndexOperation = require("../operation/removeRootDirectoryPathByIndex");
6
-
7
- const { executeOperations } = require("../utilities/operation"),
8
- { FAILED_REMOVE_ROOT_DIRECTORY_MESSAGE, SUCCESSFUL_REMOVE_ROOT_DIRECTORY_MESSAGE } = require("../messages");
9
-
10
- function removeRootDirectoryPathAction(rootDirectoryPath) {
11
- const operations = [
12
- removeRootDirectoryPathOperation,
13
- removeRootDirectoryPathPromptOperation,
14
- removeRootDirectoryPathByIndexOperation
15
- ],
16
- index = null,
17
- context = {
18
- index,
19
- rootDirectoryPath
20
- };
21
-
22
- executeOperations(operations, (completed) => {
23
- if (!completed) {
24
- console.log(FAILED_REMOVE_ROOT_DIRECTORY_MESSAGE);
25
-
26
- return;
27
- }
28
-
29
- console.log(SUCCESSFUL_REMOVE_ROOT_DIRECTORY_MESSAGE);
30
- }, context);
31
- }
32
-
33
- module.exports = removeRootDirectoryPathAction;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- const { packageUtilities } = require("necessary");
4
-
5
- const { FIND_CLI } = require("../constants");
6
-
7
- const { getVersion } = packageUtilities;
8
-
9
- function versionAction() {
10
- const version = getVersion(); ///
11
-
12
- console.log(`${FIND_CLI} version ${version}`);
13
- }
14
-
15
- module.exports = versionAction;
package/bin/commands.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- const FIND_COMMAND = "find",
4
- HELP_COMMAND = "help",
5
- VERSION_COMMAND = "version",
6
- INITIALISE_COMMAND = "initialise",
7
- ADD_ROOT_DIRECTORY_PATH_COMMAND = "add-root-directory", ///
8
- LIST_ROOT_DIRECTORY_PATHS_COMMAND = "list-root-directories", ///
9
- REMOVE_ROOT_DIRECTORY_PATH_COMMAND = "remove-root-directory"; ///
10
-
11
- module.exports = {
12
- FIND_COMMAND,
13
- HELP_COMMAND,
14
- VERSION_COMMAND,
15
- INITIALISE_COMMAND,
16
- ADD_ROOT_DIRECTORY_PATH_COMMAND,
17
- LIST_ROOT_DIRECTORY_PATHS_COMMAND,
18
- REMOVE_ROOT_DIRECTORY_PATH_COMMAND
19
- };
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- const { VERSION_1_3 } = require("../versions"),
4
- { ROOT_DIRECTORY_PATH } = require("../constants");
5
-
6
- function migrateConfigurationToVersion_1_3(configuration) {
7
- const version = VERSION_1_3,
8
- rootDirectoryPaths = [
9
- ROOT_DIRECTORY_PATH
10
- ];
11
-
12
- Object.assign(configuration, {
13
- version,
14
- rootDirectoryPaths
15
- });
16
-
17
- return configuration;
18
- }
19
-
20
- module.exports = {
21
- migrateConfigurationToVersion_1_3
22
- };
package/bin/constants.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- const S = "s",
4
- ZERO = 0,
5
- DATA = "data",
6
- FIND = "find",
7
- FILE = "file",
8
- G_FLAG = "g",
9
- FIND_CLI = "Find-CLI",
10
- DIRECTORY = "directory",
11
- EMPTY_STRING = "",
12
- SINGLE_SPACE = " ",
13
- ROOT_DIRECTORY_PATH = "./";
14
-
15
- module.exports = {
16
- S,
17
- ZERO,
18
- DATA,
19
- FIND,
20
- FILE,
21
- G_FLAG,
22
- FIND_CLI,
23
- DIRECTORY,
24
- EMPTY_STRING,
25
- SINGLE_SPACE,
26
- ROOT_DIRECTORY_PATH
27
- };
package/bin/converters.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- const periodConverter = require("./converter/period"),
4
- defaultConverter = require("./converter/default"),
5
- directoryConverter = require("./converter/directory"),
6
- alternatesConverter = require("./converter/alternates"),
7
- questionMarkConverter = require("./converter/questionMark"),
8
- characterClassConverter = require("./converter/characterClass"),
9
- singleWildcardConverter = require("./converter/singleWildcard"),
10
- singleDirectoryConverter = require("./converter/singleDirectory"),
11
- repeatedWildcardConverter = require("./converter/repeatedWildcard"),
12
- escapedCharacterConverter = require("./converter/escapedCharacter"),
13
- repeatedDirectoriesConverter = require("./converter/repeatedDirectories");
14
-
15
- const converters = [
16
- repeatedDirectoriesConverter,
17
- singleDirectoryConverter,
18
- directoryConverter,
19
- repeatedWildcardConverter,
20
- singleWildcardConverter,
21
- escapedCharacterConverter,
22
- questionMarkConverter,
23
- periodConverter,
24
- alternatesConverter,
25
- characterClassConverter,
26
- defaultConverter
27
- ];
28
-
29
- module.exports = converters;
package/bin/defaults.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- const DEFAULT_HELP = false,
4
- DEFAULT_REGEX = false,
5
- DEFAULT_STRING = false,
6
- DEFAULT_FORMAT = false,
7
- DEFAULT_VERSION = false,
8
- DEFAULT_DRY_RUN = false,
9
- DEFAULT_QUIETLY = false,
10
- DEFAULT_PREVIOUS = false,
11
- DEFAULT_INTERACTIVE = false;
12
-
13
- module.exports = {
14
- DEFAULT_HELP,
15
- DEFAULT_REGEX,
16
- DEFAULT_STRING,
17
- DEFAULT_FORMAT,
18
- DEFAULT_VERSION,
19
- DEFAULT_DRY_RUN,
20
- DEFAULT_QUIETLY,
21
- DEFAULT_PREVIOUS,
22
- DEFAULT_INTERACTIVE
23
- };
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- const GLOB_STRING_OR_REGEX_DESCRIPTION = `Glob, string or regex: `,
4
- ADD_ROOT_DIRECTORY_PATH_DESCRIPTION = `Root directory: `,
5
- REMOVE_ROOT_DIRECTORY_PATH_DESCRIPTION = `Root directory index: `,
6
- PREVIOUS_GLOB_STRING_OR_REGEX_DESCRIPTION = `Previous glob, string or regex: `;
7
-
8
- module.exports = {
9
- GLOB_STRING_OR_REGEX_DESCRIPTION,
10
- ADD_ROOT_DIRECTORY_PATH_DESCRIPTION,
11
- REMOVE_ROOT_DIRECTORY_PATH_DESCRIPTION,
12
- PREVIOUS_GLOB_STRING_OR_REGEX_DESCRIPTION
13
- };
package/bin/messages.js DELETED
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- const NO_ARGUMENT_GIVEN_MESSAGE = "No argument has been given.",
4
- NO_PREVIOUS_RULES_MESSAGE = "There are no previous rules.",
5
- NO_ROOT_DIRECTORY_PATHS_MESSAGE = "There are no root directory paths bar the default one.",
6
- COMMAND_NOT_RECOGNISED_MESSAGE = "The command is not recognised.",
7
- CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE = "The action cannot be performed because the configuration file is missing. Run 'find initialise' to create one.",
8
- INVALID_IGNORE_OR_PERMIT_MESSAGE = "You must answer (i)gnore or (p)ermit.",
9
- INVALID_ROOT_DIRECTORY_PATH_MESSAGE = "Additional root directories must be globs of the form '../**/'.",
10
- INVALID_GLOB_REGEX_OR_STRING_MESSAGE = "The glob, regex or string is invalid.",
11
- INVALID_ROOT_DIRECTORY_PATH_INDEX_MESSAGE = "The index is either not a number or not within range.",
12
- FAILED_INITIALISE_MESSAGE = "Failed to create a configuration file because one is already present.",
13
- FAILED_ADD_ROOT_DIRECTORY_MESSAGE = "Failed to add the root directory.",
14
- FAILED_REMOVE_ROOT_DIRECTORY_MESSAGE = "Failed to remove the root directory.",
15
- SUCCESSFUL_INITIALISE_MESSAGE = "The configuration file has been created successfully.",
16
- SUCCESSFUL_ADD_ROOT_DIRECTORY_MESSAGE = "Added the root directory successfully.",
17
- SUCCESSFUL_REMOVE_ROOT_DIRECTORY_MESSAGE = "Removed the root directory successfully.";
18
-
19
- module.exports = {
20
- NO_ARGUMENT_GIVEN_MESSAGE,
21
- NO_PREVIOUS_RULES_MESSAGE,
22
- NO_ROOT_DIRECTORY_PATHS_MESSAGE,
23
- COMMAND_NOT_RECOGNISED_MESSAGE,
24
- CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE,
25
- INVALID_IGNORE_OR_PERMIT_MESSAGE,
26
- INVALID_ROOT_DIRECTORY_PATH_MESSAGE,
27
- INVALID_GLOB_REGEX_OR_STRING_MESSAGE,
28
- INVALID_ROOT_DIRECTORY_PATH_INDEX_MESSAGE,
29
- FAILED_INITIALISE_MESSAGE,
30
- FAILED_ADD_ROOT_DIRECTORY_MESSAGE,
31
- FAILED_REMOVE_ROOT_DIRECTORY_MESSAGE,
32
- SUCCESSFUL_INITIALISE_MESSAGE,
33
- SUCCESSFUL_ADD_ROOT_DIRECTORY_MESSAGE,
34
- SUCCESSFUL_REMOVE_ROOT_DIRECTORY_MESSAGE
35
- };
package/bin/options.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- const HELP_OPTION = "help",
4
- GLOB_OPTION = "glob",
5
- REGEX_OPTION = "regex",
6
- STRING_OPTION = "string",
7
- FORMAT_OPTION = "format",
8
- VERSION_OPTION = "version",
9
- QUIETLY_OPTION = "quietly",
10
- DRY_RUN_OPTION = "dry-run",
11
- PREVIOUS_OPTION = "previous",
12
- INTERACTIVE_OPTION = "interactive";
13
-
14
- module.exports = {
15
- HELP_OPTION,
16
- GLOB_OPTION,
17
- REGEX_OPTION,
18
- STRING_OPTION,
19
- FORMAT_OPTION,
20
- VERSION_OPTION,
21
- QUIETLY_OPTION,
22
- DRY_RUN_OPTION,
23
- PREVIOUS_OPTION,
24
- INTERACTIVE_OPTION
25
- };
package/bin/types.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- const GLOB_TYPE = "glob",
4
- REGEX_TYPE = "regex",
5
- STRING_TYPE = "string";
6
-
7
- module.exports = {
8
- GLOB_TYPE,
9
- REGEX_TYPE,
10
- STRING_TYPE
11
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- function isStringGlobLiteral(string) {
4
- const stringStringLiteral = isStringStringLiteral(string),
5
- stringRegexLiteral = isStringRegexLiteral(string),
6
- stringGlobLiteral = (!stringStringLiteral && !stringRegexLiteral);
7
-
8
- return stringGlobLiteral;
9
- }
10
-
11
- function isStringRegexLiteral(string) { return /^\/.*?\/$/.test(string); }
12
-
13
- function isStringStringLiteral(string) { return /^".*?"$/.test(string); }
14
-
15
- module.exports = {
16
- isStringGlobLiteral,
17
- isStringRegexLiteral,
18
- isStringStringLiteral
19
- };
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- const RED_FOREGROUND_COLOUR = "\u001b[31m",
4
- GREY_FOREGROUND_COLOUR = "\u001b[90m",
5
- BLUE_FOREGROUND_COLOUR = "\u001b[34m",
6
- GREEN_FOREGROUND_COLOUR = "\u001b[32m",
7
- YELLOW_FOREGROUND_COLOUR = "\u001b[33m",
8
- RESET_FOREGROUND_COLOUR = "\u001b[39m";
9
-
10
- function red(string) { return `${RED_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
11
-
12
- function grey(string) { return `${GREY_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
13
-
14
- function blue(string) { return `${BLUE_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
15
-
16
- function green(string) { return `${GREEN_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
17
-
18
- function yellow(string) { return `${YELLOW_FOREGROUND_COLOUR}${string}${RESET_FOREGROUND_COLOUR}`; }
19
-
20
- module.exports = {
21
- red,
22
- grey,
23
- blue,
24
- green,
25
- yellow
26
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- const { EMPTY_STRING } = require("../constants");
4
-
5
- function addAnchors(string) { return `^${string}$`; }
6
-
7
- function removeAnchors(string) { return string.replace(/(^\^|\$$)/g, EMPTY_STRING); }
8
-
9
- function addForwardSlashes(string) { return `/${string}/`; }
10
-
11
- function removeDoubleQuotes(string) { return string.replace(/(^"|"$)/g, EMPTY_STRING); }
12
-
13
- function removeForwardSlashes(string) { return string.replace(/(^\/|\/$)/g, EMPTY_STRING); }
14
-
15
- function addTrailingForwardSlash(string) { return `${string}\/`; }
16
-
17
- function removeTrailingForwardSlash(string) { return string.replace(/(\/$)/, EMPTY_STRING); }
18
-
19
- function addTrailingEscapedForwardSlash(string) { return `${string}\\\/`; }
20
-
21
- function removeTrailingEscapedForwardSlash(string) { return string.replace(/(\\\/$)/, EMPTY_STRING); }
22
-
23
- module.exports = {
24
- addAnchors,
25
- removeAnchors,
26
- addForwardSlashes,
27
- removeDoubleQuotes,
28
- removeForwardSlashes,
29
- addTrailingForwardSlash,
30
- removeTrailingForwardSlash,
31
- addTrailingEscapedForwardSlash,
32
- removeTrailingEscapedForwardSlash
33
- };
package/bin/versions.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- const VERSION_1_0 = "1.0",
4
- VERSION_1_1 = "1.1",
5
- VERSION_1_2 = "1.2",
6
- VERSION_1_3 = "1.3",
7
- VERSION_1_4 = "1.4",
8
- VERSION_1_7 = "1.7";
9
-
10
- module.exports = {
11
- VERSION_1_0,
12
- VERSION_1_1,
13
- VERSION_1_2,
14
- VERSION_1_3,
15
- VERSION_1_4,
16
- VERSION_1_7
17
- };