]>
git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blob - cli/surfer.js
5 var program
= require('commander'),
6 actions
= require('./actions');
8 program
.version(require('../package.json').version
);
10 program
.command('login <url>')
11 .description('Login to server')
12 .option('--username [username]', 'Username (optional)')
13 .option('--password [password]', 'Password (optional)')
14 .action(actions
.login
);
16 program
.command('logout')
17 .description('Logout from server')
18 .action(actions
.logout
);
20 program
.command('put <file|dir> [files...]')
21 .option('-a --all', 'Also include hidden files and folders.', false)
22 .description('Put a file, last argument is destination if provided')
25 program
.command('get [file|dir]')
26 .description('Get a file or directory listing')
29 program
.command('del <file>')
30 .option('-r --recursive', 'Recursive delete directories.', false)
31 .option('-d --dry-run', 'Only list files to delete.', false)
32 .description('Delete a file or directory')
35 program
.parse(process
.argv
);
37 if (!process
.argv
.slice(2).length
) {
39 } else { // https://github.com/tj/commander.js/issues/338
40 var knownCommand
= program
.commands
.some(function (command
) { return command
._name
=== process
.argv
[2]; });
42 console
.error('Unknown command: ' + process
.argv
[2]);