move Copay.js -> API.js, and handle case of no command better
* API is a more appropriate name for what this is. It is intended to be the interface used by external apps. * The case where you run "copay" with no command is now handled better.
This commit is contained in:
parent
4773b6577a
commit
dd2e8c585e
2 changed files with 32 additions and 32 deletions
10
bin/copay
10
bin/copay
|
|
@ -1,26 +1,26 @@
|
|||
#!/usr/bin/env node
|
||||
var Copay = require('./Copay.js');
|
||||
var API = require('../API.js');
|
||||
var commander = require('commander');
|
||||
|
||||
var main = function() {
|
||||
|
||||
commander
|
||||
.version("0.0.1")
|
||||
.option('-f, --file [file]', 'AES encrypted data file', 'copay.json.aes')
|
||||
.option('-f, --file [file]', 'AES encrypted data file', 'api.json.aes')
|
||||
.option('-p, --pass [passphrase]', 'AES wallet passphrase')
|
||||
.option('-c, --client', 'Issue command over RPC to copay daemon')
|
||||
.option('-c, --client', 'Issue command over RPC to api daemon')
|
||||
.option('-d, --daemon', 'Run as daemon accepting RPC commands')
|
||||
.option('--rpcport [port]', 'RPC port [18332]', Number, 18332)
|
||||
.option('--rpcuser [user]', 'RPC user [user]', String, 'user')
|
||||
.option('--rpcpass [password]', 'RPC password [pass]', String, 'pass')
|
||||
.parse(process.argv);
|
||||
|
||||
var copay = new Copay(commander);
|
||||
var api = new API(commander);
|
||||
|
||||
var args = commander.args;
|
||||
|
||||
try {
|
||||
copay._command(args[0], args.slice(1), function(err, result) {
|
||||
api._command(args[0], args.slice(1), function(err, result) {
|
||||
if (err)
|
||||
return console.log("" + err);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue