occam-open-cli 6.0.128 → 6.0.130

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.
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ const { pathUtilities } = require("necessary");
4
+
5
+ const { DOUBLE_DOTS } = require("./constants"),
6
+ { PUBLISH_COMMAND } = require("./commands"),
7
+ { checkConfigurationFileExists, migrateConfigurationFile } = require("./configuration");
8
+
9
+ const { bottommostNameFromPath } = pathUtilities;
10
+
11
+ function configure(command, argument, options, main) {
12
+ let configurationFileExists = checkConfigurationFileExists();
13
+
14
+ if (command === PUBLISH_COMMAND) { ///
15
+ if (argument === null) {
16
+ const currentWorkingDirectoryPath = process.cwd(); ///
17
+
18
+ process.chdir(DOUBLE_DOTS);
19
+
20
+ const oldCurrentWorkingDirectoryPath = currentWorkingDirectoryPath; ///
21
+
22
+ configurationFileExists = checkConfigurationFileExists();
23
+
24
+ if (configurationFileExists) {
25
+ const bottommostOldCurrentWorkingDirectoryName = bottommostNameFromPath(oldCurrentWorkingDirectoryPath);
26
+
27
+ argument = bottommostOldCurrentWorkingDirectoryName; ///
28
+ }
29
+ }
30
+ }
31
+
32
+ if (configurationFileExists) {
33
+ migrateConfigurationFile();
34
+ }
35
+
36
+ main(command, argument, options);
37
+ }
38
+
39
+ module.exports = configure;
package/bin/main.js CHANGED
@@ -1,41 +1,76 @@
1
1
  "use strict";
2
2
 
3
- const { pathUtilities } = require("necessary");
3
+ const helpAction = require("./action/help"),
4
+ openAction = require("./action/open"),
5
+ cloneAction = require("./action/clone"),
6
+ signInAction = require("./action/signIn"),
7
+ signOutAction = require("./action/signOut"),
8
+ versionAction = require("./action/version"),
9
+ publishAction = require("./action/publish"),
10
+ withdrawAction = require("./action/withdraw"),
11
+ initialiseAction = require("./action/initialise"),
12
+ setOptionsAction = require("./action/setOptions"),
13
+ createAccountAction = require("./action/createAccount"),
14
+ resetPasswordAction = require("./action/resetPassword"),
15
+ setShellCommandsAction = require("./action/setShellCommands");
4
16
 
5
- const actions = require("./actions");
6
-
7
- const { DOUBLE_DOTS } = require("./constants"),
8
- { PUBLISH_COMMAND } = require("./commands"),
9
- { checkConfigurationFileExists, migrateConfigurationFile } = require("./configuration");
10
-
11
- const { bottommostNameFromPath } = pathUtilities;
17
+ const { DEFAULT_NO, DEFAULT_YES, DEFAULT_HELP, DEFAULT_TAIL, DEFAULT_FOLLOW, DEFAULT_DRY_RUN, DEFAULT_VERSION, DEFAULT_QUIETLY, DEFAULT_LOG_LEVEL } = require("./defaults"),
18
+ { HELP_COMMAND,
19
+ OPEN_COMMAND,
20
+ CLONE_COMMAND,
21
+ VERSION_COMMAND,
22
+ PUBLISH_COMMAND,
23
+ SIGN_IN_COMMAND,
24
+ SIGN_OUT_COMMAND,
25
+ WITHDRAW_COMMAND,
26
+ INITIALISE_COMMAND,
27
+ SET_OPTIONS_COMMAND,
28
+ CREATE_ACCOUNT_COMMAND,
29
+ RESET_PASSWORD_COMMAND,
30
+ SET_SHELL_COMMANDS_COMMAND } = require("./commands");
12
31
 
13
32
  function main(command, argument, options) {
14
- let configurationFileExists = checkConfigurationFileExists();
15
-
16
- if (command === PUBLISH_COMMAND) { ///
17
- if (argument === null) {
18
- const currentWorkingDirectoryPath = process.cwd(); ///
19
-
20
- process.chdir(DOUBLE_DOTS);
33
+ const commandMissing = (command === null),
34
+ { no = DEFAULT_NO,
35
+ yes = DEFAULT_YES,
36
+ help = DEFAULT_HELP,
37
+ tail = DEFAULT_TAIL,
38
+ follow = DEFAULT_FOLLOW,
39
+ dryRun = DEFAULT_DRY_RUN,
40
+ version = DEFAULT_VERSION,
41
+ quietly = DEFAULT_QUIETLY,
42
+ logLevel = DEFAULT_LOG_LEVEL } = options;
21
43
 
22
- const oldCurrentWorkingDirectoryPath = currentWorkingDirectoryPath; ///
23
-
24
- configurationFileExists = checkConfigurationFileExists();
44
+ if (false) {
45
+ ///
46
+ } else if (help) {
47
+ command = HELP_COMMAND;
48
+ } else if (version) {
49
+ command = VERSION_COMMAND;
50
+ } else if (commandMissing) {
51
+ command = HELP_COMMAND;
52
+ }
25
53
 
26
- if (configurationFileExists) {
27
- const bottommostOldCurrentWorkingDirectoryName = bottommostNameFromPath(oldCurrentWorkingDirectoryPath);
54
+ switch (command) {
55
+ case HELP_COMMAND: helpAction(); break;
56
+ case OPEN_COMMAND: openAction(argument, quietly, yes, no); break;
57
+ case CLONE_COMMAND: cloneAction(argument, quietly, yes, no); break;
58
+ case VERSION_COMMAND: versionAction(); break;
59
+ case PUBLISH_COMMAND: publishAction(argument, tail, follow, dryRun, logLevel); break;
60
+ case SIGN_IN_COMMAND: signInAction(argument); break;
61
+ case SIGN_OUT_COMMAND: signOutAction(); break;
62
+ case WITHDRAW_COMMAND: withdrawAction(argument); break;
63
+ case INITIALISE_COMMAND: initialiseAction(); break;
64
+ case SET_OPTIONS_COMMAND: setOptionsAction(); break;
65
+ case CREATE_ACCOUNT_COMMAND: createAccountAction(argument); break;
66
+ case RESET_PASSWORD_COMMAND: resetPasswordAction(argument); break;
67
+ case SET_SHELL_COMMANDS_COMMAND: setShellCommandsAction(); break;
28
68
 
29
- argument = bottommostOldCurrentWorkingDirectoryName; ///
30
- }
31
- }
32
- }
69
+ default:
70
+ argument = command; ///
33
71
 
34
- if (configurationFileExists) {
35
- migrateConfigurationFile();
72
+ openAction(argument, quietly, yes, no);
36
73
  }
37
-
38
- actions(command, argument, options);
39
74
  }
40
75
 
41
76
  module.exports = main;
package/open.js CHANGED
@@ -4,6 +4,7 @@ const { parseArgv } = require("argumentative"),
4
4
  { arrayUtilities } = require("necessary");
5
5
 
6
6
  const main = require("./bin/main"),
7
+ configure = require("./bin/configure"),
7
8
  abbreviations = require("./bin/abbreviations");
8
9
 
9
10
  const { argv } = process,
@@ -15,4 +16,4 @@ const { commands, options } = parseArgv(argv, abbreviations),
15
16
  command = firstCommand || null, ///
16
17
  argument = secondCommand || null; ///
17
18
 
18
- main(command, argument, options);
19
+ configure(command, argument, options, main);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "occam-open-cli",
3
3
  "author": "James Smith",
4
- "version": "6.0.128",
4
+ "version": "6.0.130",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-open-cli",
7
7
  "description": "Occam's command line package management tool.",
package/bin/actions.js DELETED
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- const helpAction = require("./action/help"),
4
- openAction = require("./action/open"),
5
- cloneAction = require("./action/clone"),
6
- signInAction = require("./action/signIn"),
7
- signOutAction = require("./action/signOut"),
8
- versionAction = require("./action/version"),
9
- publishAction = require("./action/publish"),
10
- withdrawAction = require("./action/withdraw"),
11
- initialiseAction = require("./action/initialise"),
12
- setOptionsAction = require("./action/setOptions"),
13
- createAccountAction = require("./action/createAccount"),
14
- resetPasswordAction = require("./action/resetPassword"),
15
- setShellCommandsAction = require("./action/setShellCommands");
16
-
17
- const { DEFAULT_NO, DEFAULT_YES, DEFAULT_HELP, DEFAULT_TAIL, DEFAULT_FOLLOW, DEFAULT_DRY_RUN, DEFAULT_VERSION, DEFAULT_QUIETLY, DEFAULT_LOG_LEVEL } = require("./defaults"),
18
- { HELP_COMMAND,
19
- OPEN_COMMAND,
20
- CLONE_COMMAND,
21
- VERSION_COMMAND,
22
- PUBLISH_COMMAND,
23
- SIGN_IN_COMMAND,
24
- SIGN_OUT_COMMAND,
25
- WITHDRAW_COMMAND,
26
- INITIALISE_COMMAND,
27
- SET_OPTIONS_COMMAND,
28
- CREATE_ACCOUNT_COMMAND,
29
- RESET_PASSWORD_COMMAND,
30
- SET_SHELL_COMMANDS_COMMAND } = require("./commands");
31
-
32
- function actions(command, argument, options) {
33
- const commandMissing = (command === null),
34
- { no = DEFAULT_NO,
35
- yes = DEFAULT_YES,
36
- help = DEFAULT_HELP,
37
- tail = DEFAULT_TAIL,
38
- follow = DEFAULT_FOLLOW,
39
- dryRun = DEFAULT_DRY_RUN,
40
- version = DEFAULT_VERSION,
41
- quietly = DEFAULT_QUIETLY,
42
- logLevel = DEFAULT_LOG_LEVEL } = options;
43
-
44
- if (false) {
45
- ///
46
- } else if (help) {
47
- command = HELP_COMMAND;
48
- } else if (version) {
49
- command = VERSION_COMMAND;
50
- } else if (commandMissing) {
51
- command = HELP_COMMAND;
52
- }
53
-
54
- switch (command) {
55
- case HELP_COMMAND: helpAction(); break;
56
- case OPEN_COMMAND: openAction(argument, quietly, yes, no); break;
57
- case CLONE_COMMAND: cloneAction(argument, quietly, yes, no); break;
58
- case VERSION_COMMAND: versionAction(); break;
59
- case PUBLISH_COMMAND: publishAction(argument, tail, follow, dryRun, logLevel); break;
60
- case SIGN_IN_COMMAND: signInAction(argument); break;
61
- case SIGN_OUT_COMMAND: signOutAction(); break;
62
- case WITHDRAW_COMMAND: withdrawAction(argument); break;
63
- case INITIALISE_COMMAND: initialiseAction(); break;
64
- case SET_OPTIONS_COMMAND: setOptionsAction(); break;
65
- case CREATE_ACCOUNT_COMMAND: createAccountAction(argument); break;
66
- case RESET_PASSWORD_COMMAND: resetPasswordAction(argument); break;
67
- case SET_SHELL_COMMANDS_COMMAND: setShellCommandsAction(); break;
68
-
69
- default:
70
- argument = command; ///
71
-
72
- openAction(argument, quietly, yes, no);
73
- }
74
- }
75
-
76
- module.exports = actions;