-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
51 lines (41 loc) · 1.52 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* index.js
*
* (C) 2012 Crosstalk Systems Inc.
*/
var crosstalkApiClient = require( 'crosstalk-api-client' ),
flatiron = require( 'flatiron' ),
path = require( 'path' ),
app = flatiron.app;
app.version = require( path.join( __dirname, 'package.json' ) ).version;
app.config.file( 'global', { file : path.join( __dirname, 'config', 'config.json' ) } );
app.configFilePath = process.env.CROSSTALK_CONFIG || path.join( process.env.HOME, '.crosstalk.config');
app.config.file( 'user', { file : app.configFilePath } );
app.use( flatiron.plugins.cli, {
dir : path.join( __dirname, 'lib', 'commands' ),
usage : [
'Crosstalk CLI',
'Valid commands are:',
'',
'crosstalk signup',
'crosstalk activate',
'crosstalk account *',
'crosstalk login [ACCOUNT_NAME]',
'crosstalk logout',
'crosstalk version',
'crosstalk worker *',
''
],
version : true
}); // app.use flatiron.plugins.cli
app.alias( 'activate', { resource : 'account', command : 'activate' } );
app.alias( 'signup', { resource : 'account', command : 'create' } );
app.api = {};
app.api.accounts = new ( crosstalkApiClient.Accounts )( app.config.get( 'api' ) );
app.api.login = new ( crosstalkApiClient.Login )( app.config.get( 'api' ) );
app.api.logout = new ( crosstalkApiClient.Logout )( app.config.get( 'api' ) );
app.api.send = new ( crosstalkApiClient.Send )( app.config.get( 'send' ) );
app.api.version = new ( crosstalkApiClient.Version )( app.config.get( 'api' ) );
app.start( function () {
process.exit( 0 );
});