mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-30 16:13:59 +00:00
Add provider argument
This commit is contained in:
parent
bb4c2b1f82
commit
19b6d194ea
@ -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<IArg<any>> = [
|
||||
{
|
||||
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]';
|
||||
|
||||
|
@ -65,6 +65,11 @@ export default class InstanceInitCmd extends Command {
|
||||
public static usage = 'instance init';
|
||||
|
||||
public static args: Array<IArg<any>> = [
|
||||
{
|
||||
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<FlagsDef, { configFile: string }>(InstanceInitCmd);
|
||||
const { args: params, flags: options } = this.parse<FlagsDef, { configFile: string, provider: string }>(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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user