Skip to content

Commit

Permalink
Publish
Browse files Browse the repository at this point in the history
  • Loading branch information
thedrlambda committed Feb 24, 2024
1 parent 252246d commit 13eb6e1
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
## Fixes and improvements
-

# 2.1.1
## Fixes and improvements
- Allow more characters in text fields ('<>\')
- Fix 'dot' bug
- Better error message for `post` when there are no active keys

# 2.1.0
## Added features
- Add context sensitive `delete` command
Expand Down
Binary file modified dist/windows.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@merrymake/cli",
"version": "2.1.0",
"version": "2.1.1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ function cleanup() {
function choice(options, opts) {
return new Promise((resolve) => {
var _a, _b;
if (options.length === 0) {
console.log((opts === null || opts === void 0 ? void 0 : opts.errorMessage) || "There are no options.");
process.exit(1);
}
let quick = {};
let str = [];
if (options.length === 1 && (opts === null || opts === void 0 ? void 0 : opts.disableAutoPick) !== true) {
Expand Down Expand Up @@ -466,7 +470,6 @@ function shortText(prompt, description, defaultValueArg) {
}
else if ((k === exports.BACKSPACE ||
k.charCodeAt(0) === 8 ||
k.charCodeAt(0) === 46 ||
k.charCodeAt(0) === 127) &&
beforeCursor.length > 0) {
moveCursor(-beforeCursor.length, 0);
Expand All @@ -475,7 +478,7 @@ function shortText(prompt, description, defaultValueArg) {
output(beforeCursor + afterCursor);
moveCursor(-afterCursor.length, 0);
}
else if (/^[A-Za-z0-9@_, .\-/:;#=&*?+]+$/.test(k)) {
else if (/^[A-Za-z0-9@_, .\-/:;#=&*?+<>\\]+$/.test(k)) {
moveCursor(-beforeCursor.length, 0);
beforeCursor += k;
node_process_1.stdout.clearLine(1);
Expand Down
8 changes: 6 additions & 2 deletions prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,14 @@ export function choice(
def?: number;
disableAutoPick?: boolean;
invertedQuiet?: { cmd: boolean; select: boolean };
errorMessage?: string;
}
) {
return new Promise<never>((resolve) => {
if (options.length === 0) {
console.log(opts?.errorMessage || "There are no options.");
process.exit(1);
}
let quick: { [key: string]: Option } = {};
let str: string[] = [];
if (options.length === 1 && opts?.disableAutoPick !== true) {
Expand Down Expand Up @@ -527,7 +532,6 @@ export function shortText(
} else if (
(k === BACKSPACE ||
k.charCodeAt(0) === 8 ||
k.charCodeAt(0) === 46 ||
k.charCodeAt(0) === 127) &&
beforeCursor.length > 0
) {
Expand All @@ -536,7 +540,7 @@ export function shortText(
stdout.clearLine(1);
output(beforeCursor + afterCursor);
moveCursor(-afterCursor.length, 0);
} else if (/^[A-Za-z0-9@_, .\-/:;#=&*?+]+$/.test(k)) {
} else if (/^[A-Za-z0-9@_, .\-/:;#=&*?+<>\\]+$/.test(k)) {
moveCursor(-beforeCursor.length, 0);
beforeCursor += k;
stdout.clearLine(1);
Expand Down
4 changes: 3 additions & 1 deletion questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,9 @@ function post_event(org, eventType) {
action: () => post_event_key(eventType, x.key),
};
});
return yield (0, prompt_1.choice)(options).then((x) => x);
return yield (0, prompt_1.choice)(options, {
errorMessage: `Organization has no active API keys. You can create one with '${prompt_1.YELLOW}${process.env["COMMAND"]} key${prompt_1.NORMAL_COLOR}'`,
}).then((x) => x);
}
catch (e) {
throw e;
Expand Down
5 changes: 4 additions & 1 deletion questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
spinner_start,
spinner_stop,
multiSelect,
YELLOW,
} from "./prompt";
import {
abort,
Expand Down Expand Up @@ -916,7 +917,9 @@ async function post_event(org: string, eventType: string) {
action: () => post_event_key(eventType, x.key),
};
});
return await choice(options).then((x) => x);
return await choice(options, {
errorMessage: `Organization has no active API keys. You can create one with '${YELLOW}${process.env["COMMAND"]} key${NORMAL_COLOR}'`,
}).then((x) => x);
} catch (e) {
throw e;
}
Expand Down

0 comments on commit 13eb6e1

Please sign in to comment.