Skip to content

Commit

Permalink
feat!: Restructure sandbox commands (#1268)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandenrodgers authored Nov 22, 2024
1 parent f488c36 commit 6d004ec
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
6 changes: 1 addition & 5 deletions commands/sandbox.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
// @ts-nocheck
const { addConfigOptions, addAccountOptions } = require('../lib/commonOpts');
const { i18n } = require('../lib/lang');
const { uiBetaTag } = require('../lib/ui');
const create = require('./sandbox/create');
const del = require('./sandbox/delete');

const i18nKey = 'commands.sandbox';

exports.command = 'sandbox';
exports.command = ['sandbox', 'sandboxes'];
exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);

exports.builder = yargs => {
addConfigOptions(yargs);
addAccountOptions(yargs);

yargs
.command(create)
.command(del)
Expand Down
8 changes: 4 additions & 4 deletions commands/sandbox/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const {

const i18nKey = 'commands.sandbox.subcommands.create';

exports.command = 'create [--name] [--type]';
exports.command = 'create';
exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);

exports.handler = async options => {
Expand Down Expand Up @@ -184,10 +184,10 @@ exports.handler = async options => {
};

exports.builder = yargs => {
yargs.option('f', {
yargs.option('force', {
type: 'boolean',
alias: 'force',
describe: i18n(`${i18nKey}.examples.force`),
alias: 'f',
describe: i18n(`${i18nKey}.options.force.describe`),
});
yargs.option('name', {
describe: i18n(`${i18nKey}.options.name.describe`),
Expand Down
8 changes: 4 additions & 4 deletions commands/sandbox/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const { getValidEnv } = require('@hubspot/local-dev-lib/environment');

const i18nKey = 'commands.sandbox.subcommands.delete';

exports.command = 'delete [--account]';
exports.command = 'delete';
exports.describe = exports.describe = uiBetaTag(
i18n(`${i18nKey}.describe`),
false
Expand Down Expand Up @@ -233,10 +233,10 @@ exports.builder = yargs => {
describe: i18n(`${i18nKey}.options.account.describe`),
type: 'string',
});
yargs.option('f', {
yargs.option('force', {
type: 'boolean',
alias: 'force',
describe: i18n(`${i18nKey}.examples.force`),
alias: 'f',
describe: i18n(`${i18nKey}.options.force.describe`),
});

yargs.example([
Expand Down
12 changes: 7 additions & 5 deletions lang/en.lyaml
Original file line number Diff line number Diff line change
Expand Up @@ -750,18 +750,19 @@ en:
path:
describe: "Remote hubspot path"
sandbox:
describe: "Commands for working with sandboxes."
describe: "Commands for managing sandboxes."
subcommands:
create:
describe: "Create a sandbox account"
describe: "Create a sandbox account."
examples:
default: "Creates a standard sandbox account named MySandboxAccount."
force: "Skips all confirmation prompts when creating a sandbox account."
debug:
error: "Error creating sandbox:"
info:
auth: "Run `hs auth` to authenticate with the new sandbox account."
options:
force:
describe: "Skips all confirmation prompts when creating a sandbox account."
name:
describe: "Name to use for created sandbox"
type:
Expand All @@ -774,13 +775,12 @@ en:
\n- Run {{#bold}}hs accounts use{{/bold}} to switch to your default account to your production account.
\n- Run {{#bold}}hs auth{{/bold}} to connect a production account to the HubSpot CLI.\n"
delete:
describe: "Delete a sandbox account"
describe: "Delete a sandbox account."
debug:
deleting: "Deleting sandbox account \"{{ account }}\""
error: "Error deleting sandbox account:"
examples:
default: "Deletes the sandbox account named MySandboxAccount."
force: "Skips all confirmation prompts when deleting a sandbox account."
confirm: "Delete sandbox {{#bold}}{{ account }}{{/bold}}? All data for this sandbox will be permanently deleted."
defaultAccountWarning: "The sandbox {{#bold}}{{ account }}{{/bold}} is currently set as the default account."
success:
Expand All @@ -796,6 +796,8 @@ en:
noParentPortalAvailable: "This sandbox can't be deleted from the CLI because you haven't given the CLI access to its parent account. To do this, run {{#bold}}{{ command }}{{/bold}}. You can also delete the sandbox from the HubSpot management tool: {{#bold}}{{ url }}{{/bold}}."
invalidKey: "Your personal access key for account {{#bold}}{{ account }}{{/bold}} is inactive. To re-authenticate, please run {{#bold}}hs auth personalaccesskey{{/bold}}."
options:
force:
describe: "Skips all confirmation prompts when deleting a sandbox account."
account:
describe: "Account name or id to delete"
secrets:
Expand Down

0 comments on commit 6d004ec

Please sign in to comment.