Skip to content

Commit

Permalink
Improve prompting behavior for hs custom-object create (#1321)
Browse files Browse the repository at this point in the history
  • Loading branch information
camden11 authored Jan 8, 2025
1 parent 135ca72 commit 6191ed1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions commands/customObject/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ exports.describe = i18n(`${i18nKey}.describe`);
exports.handler = async options => {
const { path, name: providedName, derivedAccountId } = options;
let definitionPath = path;
let name = providedName;

trackCommandUsage('custom-object-batch-create', null, derivedAccountId);

if (!name) {
name = await inputPrompt(i18n(`${i18nKey}.inputName`));
}

if (!definitionPath) {
definitionPath = await inputPrompt(i18n(`${i18nKey}.inputPath`));
}
Expand All @@ -34,9 +39,6 @@ exports.handler = async options => {
process.exit(EXIT_CODES.ERROR);
}

const name =
providedName || (await inputPrompt(i18n(`${i18nKey}.inputSchema`)));

try {
await batchCreateObjects(derivedAccountId, name, objectJson);
logger.success(i18n(`${i18nKey}.success.objectsCreated`));
Expand Down
4 changes: 2 additions & 2 deletions lang/en.lyaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ en:
describe: "Schema name to add the object instance to"
success:
objectsCreated: "Objects created"
inputSchema: "What would you like to name the schema?"
inputPath: "[--path] Where is the JSON file containing the object definitions?"
inputName: "[--name] Enter the name of the schema for the custom object(s) you'd like to create:"
inputPath: "[--path] Enter the path to the JSON file containing the object definitions:"
schema:
describe: "Commands for managing custom object schemas."
subcommands:
Expand Down

0 comments on commit 6191ed1

Please sign in to comment.