occam-verify-cli 0.0.776 → 0.0.778

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
@@ -1,9 +1,59 @@
1
1
  "use strict";
2
2
 
3
- const actions = require("./actions");
3
+ const { Log } = require("../lib/index"); ///
4
+
5
+ const helpAction = require("./action/help"),
6
+ verifyAction = require("./action/verify"),
7
+ versionAction = require("./action/version");
8
+
9
+ const { HELP_COMMAND, VERIFY_COMMAND, VERSION_COMMAND } = require("./commands"),
10
+ { DEFAULT_HELP, DEFAULT_TAIL, DEFAULT_FOLLOW, DEFAULT_VERSION, DEFAULT_LOG_LEVEL } = require("./defaults");
4
11
 
5
12
  function main(command, argument, options) {
6
- actions(command, argument, options);
13
+ const commandMissing = (command === null),
14
+ { help = DEFAULT_HELP,
15
+ tail = DEFAULT_TAIL,
16
+ follow = DEFAULT_FOLLOW,
17
+ version = DEFAULT_VERSION,
18
+ logLevel = DEFAULT_LOG_LEVEL } = options;
19
+
20
+ if (false) {
21
+ ///
22
+ } else if (help) {
23
+ command = HELP_COMMAND;
24
+ } else if (version) {
25
+ command = VERSION_COMMAND;
26
+ } else if (commandMissing) {
27
+ command = HELP_COMMAND;
28
+ }
29
+
30
+ const log = Log.fromFollowAndLogLevel(follow, logLevel);
31
+
32
+ switch (command) {
33
+ case HELP_COMMAND: helpAction(); break;
34
+ case VERIFY_COMMAND: { verifyAction(argument, log); break; }
35
+ case VERSION_COMMAND: versionAction(); break;
36
+
37
+ default: {
38
+ argument = command; ///
39
+
40
+ verifyAction(argument, log);
41
+
42
+ break;
43
+ }
44
+ }
45
+
46
+ if (!follow) {
47
+ let messages = log.getMessages()
48
+
49
+ const start = - tail;
50
+
51
+ messages = messages.slice(start); ///
52
+
53
+ messages.forEach((message) => {
54
+ console.log(message);
55
+ });
56
+ }
7
57
  }
8
58
 
9
59
  module.exports = main;
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.776",
4
+ "version": "0.0.778",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-verify-cli",
7
7
  "description": "Occam's Verifier",
package/bin/actions.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- const { Log } = require("../lib/index"); ///
4
-
5
- const helpAction = require("./action/help"),
6
- verifyAction = require("./action/verify"),
7
- versionAction = require("./action/version");
8
-
9
- const { HELP_COMMAND, VERIFY_COMMAND, VERSION_COMMAND } = require("./commands"),
10
- { DEFAULT_HELP, DEFAULT_TAIL, DEFAULT_FOLLOW, DEFAULT_VERSION, DEFAULT_LOG_LEVEL } = require("./defaults");
11
-
12
- function actions(command, argument, options) {
13
- const commandMissing = (command === null),
14
- { help = DEFAULT_HELP,
15
- tail = DEFAULT_TAIL,
16
- follow = DEFAULT_FOLLOW,
17
- version = DEFAULT_VERSION,
18
- logLevel = DEFAULT_LOG_LEVEL } = options;
19
-
20
- if (false) {
21
- ///
22
- } else if (help) {
23
- command = HELP_COMMAND;
24
- } else if (version) {
25
- command = VERSION_COMMAND;
26
- } else if (commandMissing) {
27
- command = HELP_COMMAND;
28
- }
29
-
30
- const log = Log.fromFollowAndLogLevel(follow, logLevel);
31
-
32
- switch (command) {
33
- case HELP_COMMAND: helpAction(); break;
34
- case VERIFY_COMMAND: { verifyAction(argument, log); break; }
35
- case VERSION_COMMAND: versionAction(); break;
36
-
37
- default: {
38
- argument = command; ///
39
-
40
- verifyAction(argument, log);
41
-
42
- break;
43
- }
44
- }
45
-
46
- if (!follow) {
47
- let messages = log.getMessages()
48
-
49
- const start = - tail;
50
-
51
- messages = messages.slice(start); ///
52
-
53
- messages.forEach((message) => {
54
- console.log(message);
55
- });
56
- }
57
- }
58
-
59
- module.exports = actions;