diff --git a/lib/commands/instance/index.ts b/lib/commands/instance/index.ts index 5506b191..3cdc9e2f 100644 --- a/lib/commands/instance/index.ts +++ b/lib/commands/instance/index.ts @@ -16,6 +16,7 @@ */ import { flags } from '@oclif/command'; +import { IArg } from '@oclif/parser/lib/args'; import Command from '../../command'; import * as cf from '../../utils/common-flags'; import { stripIndent } from '../../utils/lazy'; @@ -25,13 +26,23 @@ interface FlagsDef { v13: boolean; } + export default class InstanceCmd extends Command { + public static args: Array> = [ + { + name: 'provider', + description: 'the cloud provider', + required: true, + }, + ]; + + public static description = stripIndent` Initialize a new cloud instance running balenaOS A config.json must first be generated using the 'balena config generate' command `; - public static examples = ['$ balena instance init']; + public static examples = ['$ balena instance init digitalocean']; public static usage = 'instance [COMMAND]'; diff --git a/lib/commands/instance/init.ts b/lib/commands/instance/init.ts index 72c2e8ce..d95e5344 100644 --- a/lib/commands/instance/init.ts +++ b/lib/commands/instance/init.ts @@ -65,6 +65,11 @@ export default class InstanceInitCmd extends Command { public static usage = 'instance init'; public static args: Array> = [ + { + name: 'provider', + description: 'the cloud provider: do | digitalocean | aws | gcp', + required: true, + }, { name: 'configFile', description: 'the config.json file path', @@ -92,7 +97,12 @@ export default class InstanceInitCmd extends Command { public static authenticated = true; public async run() { - const { args: params, flags: options } = this.parse(InstanceInitCmd); + const { args: params, flags: options } = this.parse(InstanceInitCmd); + + if (!['do', 'digitalocean'].includes(params.provider)) { + console.error('Only DigitalOcean is supported as a provider, please use "do" or "digitalocean" as your provider positional argument.') + return + } // Check if the config file exists console.log('Reading config file')