Wallet/bin/copay
Ryan X. Charles 26073921fb add initial command-line interface
You can see commands by running "copay getCommands"

Types are enforced - right now only strings work. This is so that types can be
coerced from the command-line correctly. Number of arguments are also enforced.
In the future you will be able to pass in JSON objects as arguments and they
will be translated to real objects.
2014-04-14 18:24:46 -03:00

32 lines
976 B
JavaScript
Executable file

#!/usr/bin/env node
var Copay = require('./Copay.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('-p, --pass [passphrase]', 'AES wallet passphrase')
.option('-c, --client', 'Issue command over RPC to copay 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 args = commander.args;
copay._command(args[0], args.slice(1), function(err, result) {
if (err)
return console.log("" + err);
console.log(JSON.stringify(result, null, 2));
});
};
if (require.main === module) {
main();
}