occam-verify-cli 0.0.321 → 0.0.322

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.
package/bin/main.js CHANGED
@@ -4,10 +4,9 @@ const { arrayUtilities } = require("necessary"),
4
4
  { fileSystemUtilities } = require("occam-file-system"),
5
5
  { verifyRelease, releaseContextUtilities } = require("../lib/index");
6
6
 
7
- const callbacks = require("./callbacks");
8
-
9
7
  const { log } = require("./utilities/logging"),
10
- { PERIOD } = require("./constants");
8
+ { PERIOD } = require("./constants"),
9
+ { callbacksFromLog } = require("./utilities/callbacks");
11
10
 
12
11
  const { first } = arrayUtilities,
13
12
  { loadRelease } = fileSystemUtilities,
@@ -20,6 +19,7 @@ function main(commands, options) {
20
19
  shortenedVersion = null,
21
20
  dependentNames = [],
22
21
  connection = null, ///
22
+ callbacks = callbacksFromLog(log),
23
23
  context = {
24
24
  log,
25
25
  callbacks,
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ const { levels } = require("necessary"),
4
+ { Callbacks } = require("../../lib/index");
5
+
6
+ const { HALT_MESSAGE, BEGIN_MESSAGE, COMPLETED_MESSAGE } = require("../messages");
7
+
8
+ const { TRACE_LEVEL } = levels;
9
+
10
+ function callbacksFromLog(log) {
11
+ const level = TRACE_LEVEL;
12
+
13
+ function halt(filePath, leastLineIndex, greatestLineIndex) {
14
+ let message = HALT_MESSAGE;
15
+
16
+ message = messageFromMessageFilePathLeastLineIndexAndGreatestLineIndex(message, filePath, leastLineIndex, greatestLineIndex);
17
+
18
+ log(level, message);
19
+ }
20
+
21
+ function begin(filePath, leastLineIndex, greatestLineIndex) {
22
+ let message = BEGIN_MESSAGE;
23
+
24
+ message = messageFromMessageFilePathLeastLineIndexAndGreatestLineIndex(message, filePath, leastLineIndex, greatestLineIndex);
25
+
26
+ log(level, message);
27
+ }
28
+
29
+ function complete(filePath, leastLineIndex, greatestLineIndex) {
30
+ let message = COMPLETED_MESSAGE;
31
+
32
+ message = messageFromMessageFilePathLeastLineIndexAndGreatestLineIndex(message, filePath, leastLineIndex, greatestLineIndex);
33
+
34
+ log(level, message);
35
+ }
36
+
37
+ const callbacks = Callbacks.fromHaltBeginAndComplete(halt, begin, complete);
38
+
39
+ return callbacks;
40
+ }
41
+
42
+
43
+ module.exports = {
44
+ callbacksFromLog
45
+ };
46
+
47
+ function messageFromMessageFilePathLeastLineIndexAndGreatestLineIndex(message, filePath, leastLineIndex, greatestLineIndex) {
48
+ if (leastLineIndex === greatestLineIndex) {
49
+ const lineIndex = leastLineIndex; ///
50
+
51
+ message = `'${filePath}' : [${lineIndex}] - ${message}`;
52
+ } else {
53
+ message = `'${filePath}' : [${leastLineIndex}-${greatestLineIndex}] - ${message}`;
54
+ }
55
+
56
+ return message;
57
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "occam-verify-cli",
3
3
  "author": "James Smith",
4
- "version": "0.0.321",
4
+ "version": "0.0.322",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-verify-cli",
7
7
  "description": "Occam's Verifier",
package/bin/callbacks.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- const { Callbacks } = require("../lib/index");
4
-
5
- const { HALT_MESSAGE, BEGIN_MESSAGE, COMPLETED_MESSAGE } = require("./messages");
6
-
7
- function halt(filePath, leastLineIndex, greatestLineIndex) { message(HALT_MESSAGE, filePath, leastLineIndex, greatestLineIndex); } ///
8
-
9
- function begin(filePath, leastLineIndex, greatestLineIndex) { message(BEGIN_MESSAGE, filePath, leastLineIndex, greatestLineIndex); } ///
10
-
11
- function complete(filePath, leastLineIndex, greatestLineIndex) { message(COMPLETED_MESSAGE, filePath, leastLineIndex, greatestLineIndex); } ///
12
-
13
- const callbacks = Callbacks.fromHaltBeginAndComplete(halt, begin, complete);
14
-
15
- module.exports = callbacks;
16
-
17
- function message(message, filePath, leastLineIndex, greatestLineIndex) {
18
- if (leastLineIndex === greatestLineIndex) {
19
- const lineIndex = leastLineIndex; ///
20
-
21
- message = `'${filePath}' : [${lineIndex}] - ${message}`;
22
- } else {
23
- message = `'${filePath}' : [${leastLineIndex}-${greatestLineIndex}] - ${message}`;
24
- }
25
-
26
- console.log(message);
27
- }