UNPKG

3.9 kBPlain TextView Raw
1#!/usr/bin/env node
2/****************************************************************************
3 The MIT License (MIT)
4
5 Copyright (c) 2014 Apigee Corporation
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 ****************************************************************************/
25'use strict';
26
27var cli = require('../lib/util/cli');
28var execute = cli.execute;
29var app = require('commander');
30var account = require('../lib/commands/account/account');
31
32app
33 .command('create <account>')
34 .option('-p, --provider <provider>', 'name of provider')
35 .option('-b, --baseuri <baseuri>', 'base uri')
36 .option('-o, --organization <organization>', 'organization')
37 .option('-u, --username <username>', 'username')
38 .option('-w, --password <password>', 'password')
39 .option('-e, --environment <environment>', 'environment')
40 .option('-v, --virtualhosts <virtualhosts>', 'virtual hosts')
41 .option('-n, --noservice', 'no create service prompt')
42 .description('Create a new deployment account')
43 .action(execute(account.create));
44
45app
46 .command('delete [account]')
47 .description('Delete an deployment account')
48 .action(execute(account.delete));
49
50app
51 .command('select [account]')
52 .description('Select an deployment account')
53 .action(execute(account.select));
54
55app
56 .command('show [account]')
57 .option('-a, --account <account>', 'name of account')
58 .description('Show a deployment account (name is optional - default shows current)')
59 .action(execute(account.show, 'Account'));
60
61app
62 .command('update [account]')
63 .description('Update a deployment account')
64 .action(execute(account.update));
65
66app
67 .command('setValue <key> <value>')
68 .option('-a, --account <account>', 'name of account')
69 .description('Set a value on the account')
70 .action(execute(account.setValue));
71
72app
73 .command('deleteValue <key>')
74 .option('-a, --account <account>', 'name of account')
75 .description('Delete a value from the account')
76 .action(execute(account.deleteValue));
77
78app
79 .command('list')
80 .alias('ls')
81 .description('List deployment accounts')
82 .action(execute(account.list, 'Accounts'));
83
84app
85 .command('providers')
86 .description('List available providers')
87 .action(execute(account.providers, 'Providers'));
88
89//app
90// .command('service-types [account]')
91// .description('List services types available to create for an Account')
92// .action(execute(account.services, 'Services'));
93//
94//app
95// .command('services [account]')
96// .description('List services created on this account')
97// .action(execute(account.services, 'Services'));
98//
99
100// todo: how to handle provider-specific extensions like this?
101app
102 .command('deployments [account]')
103 .option('-a, --account <account>', 'name of account')
104 .option('-l, --long', 'long format (includes URIs)')
105 .description('List deployments')
106 .action(execute(account.deployments, 'Deployments'));
107
108app.parse(process.argv);
109
110cli.validate(app);