bob-core 0.9.8 → 0.9.10

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,11 @@
1
+ import { BobError } from "./BobError";
2
+ export type OptionProps = {
3
+ option: string;
4
+ value?: string;
5
+ reason?: string;
6
+ };
7
+ export declare class BadCommandOption extends BobError {
8
+ readonly param: OptionProps;
9
+ constructor(param: OptionProps);
10
+ pretty(): void;
11
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BadCommandOption = void 0;
7
+ const BobError_1 = require("./BobError");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ class BadCommandOption extends BobError_1.BobError {
10
+ param;
11
+ constructor(param) {
12
+ let message = `Option "${param.option}" value is invalid.`;
13
+ if (param.reason) {
14
+ message += ` Reason: ${param.reason}`;
15
+ }
16
+ else {
17
+ message += ` Value: "${param.value}"`;
18
+ }
19
+ super(message);
20
+ this.param = param;
21
+ }
22
+ pretty() {
23
+ const log = console.log;
24
+ log((0, chalk_1.default) ` {white.bgRed ERROR } Option {bold.yellow ${this.param.option}} value is invalid. `);
25
+ if (this.param.value || this.param.reason) {
26
+ log('');
27
+ }
28
+ if (this.param.value) {
29
+ log((0, chalk_1.default) ` {blue Value}: ${this.param.value}`);
30
+ }
31
+ if (this.param.reason) {
32
+ log((0, chalk_1.default) ` {yellow Reason}: ${this.param.reason}`);
33
+ }
34
+ }
35
+ }
36
+ exports.BadCommandOption = BadCommandOption;
@@ -0,0 +1,11 @@
1
+ import { BobError } from "./BobError";
2
+ export type ParameterProps = {
3
+ param: string;
4
+ value?: string;
5
+ reason?: string;
6
+ };
7
+ export declare class BadCommandParameter extends BobError {
8
+ readonly param: ParameterProps;
9
+ constructor(param: ParameterProps);
10
+ pretty(): void;
11
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BadCommandParameter = void 0;
7
+ const BobError_1 = require("./BobError");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ class BadCommandParameter extends BobError_1.BobError {
10
+ param;
11
+ constructor(param) {
12
+ let message = `Argument "${param.param}" value is invalid.`;
13
+ if (param.reason) {
14
+ message += ` Reason: ${param.reason}`;
15
+ }
16
+ else {
17
+ message += ` Value: "${param.value}"`;
18
+ }
19
+ super(message);
20
+ this.param = param;
21
+ }
22
+ pretty() {
23
+ const log = console.log;
24
+ log((0, chalk_1.default) ` {white.bgRed ERROR } Argument {bold.yellow ${this.param.param}} value is invalid. `);
25
+ if (this.param.value || this.param.reason) {
26
+ log('');
27
+ }
28
+ if (this.param.value) {
29
+ log((0, chalk_1.default) ` {blue Value}: ${this.param.value}`);
30
+ }
31
+ if (this.param.reason) {
32
+ log((0, chalk_1.default) ` {yellow Reason}: ${this.param.reason}`);
33
+ }
34
+ }
35
+ }
36
+ exports.BadCommandParameter = BadCommandParameter;
@@ -0,0 +1,3 @@
1
+ export * from './BobError';
2
+ export * from './BadCommandParameter';
3
+ export * from './BadCommandOption';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BobError"), exports);
18
+ __exportStar(require("./BadCommandParameter"), exports);
19
+ __exportStar(require("./BadCommandOption"), exports);
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './Command';
2
2
  export * from './Cli';
3
+ export * from './errors';
package/dist/index.js CHANGED
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Command"), exports);
18
18
  __exportStar(require("./Cli"), exports);
19
+ __exportStar(require("./errors"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bob-core",
3
- "version": "0.9.8",
3
+ "version": "0.9.10",
4
4
  "description": "BOB Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",