baidubce-cli
Version:
baidu cloud engine command line tools
51 lines (36 loc) • 1.33 kB
JavaScript
/**
* Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
var fs = require('fs');
var path = require('path');
var srcDir = path.join(__dirname, '..', 'src');
function usage() {
console.log('Usage: %s <service>\n', process.argv[1]);
console.log('Services:');
fs.readdirSync(srcDir)
.filter(function(item) {
return fs.statSync(path.join(srcDir, item)).isDirectory();
})
.forEach(function(service) {
console.log(' %s', service);
});
}
var service = process.argv[2];
if (!service || !fs.existsSync(path.join(srcDir, service))) {
usage();
}
else {
process.argv.splice(2, 1);
require(path.join(srcDir, service, 'cli.js')).run();
}
/* vim: set ts=4 sw=4 sts=4 tw=120: */