5 var program
= require('commander'),
6 actions
= require('./actions');
8 // Allow self signed certs!
9 process
.env
.NODE_TLS_REJECT_UNAUTHORIZED
= '0';
11 program
.version('0.1.0');
13 program
.command('login <url>')
14 .description('Login to server')
15 .action(actions
.login
);
17 program
.command('put <file> [files...]')
18 .option('-a --all', 'Also include hidden files and folders.', false)
19 .description('Put a file, last argument is destination if provided')
22 program
.command('get [file]')
23 .description('Get a file or directory listing')
26 program
.command('del <file>')
27 .option('-r --recursive', 'Recursive delete directories.', false)
28 .option('-d --dry-run', 'Only list files to delete.', false)
29 .description('Delete a file or directory')
32 program
.parse(process
.argv
);
34 if (!process
.argv
.slice(2).length
) {
36 } else { // https://github.com/tj/commander.js/issues/338
37 var knownCommand
= program
.commands
.some(function (command
) { return command
._name
=== process
.argv
[2]; });
39 console
.error('Unknown command: ' + process
.argv
[2]);