Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve prompting behavior for hs custom-object create #1321

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading