]>
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 // Those override the login settings if provided
11 program
.option('-s, --server <url>', 'Server URL (optional)');
12 program
.option('-t, --token <access token>', 'Server Access Token (optional)');
14 program
.command('login <url>')
15 .description('Login to server')
16 .option('--username [username]', 'Username (optional)')
17 .option('--password [password]', 'Password (optional)')
18 .action(actions
.login
);
20 program
.command('logout')
21 .description('Logout from server')
22 .action(actions
.logout
);
24 program
.command('put <file|dir> [files...]')
25 .option('-a --all', 'Also include hidden files and folders.', false)
26 .description('Put a file, last argument is destination if provided')
29 program
.command('get [file|dir]')
30 .description('Get a file or directory listing')
33 program
.command('del <file>')
34 .option('-r --recursive', 'Recursive delete directories.', false)
35 .option('-d --dry-run', 'Only list files to delete.', false)
36 .description('Delete a file or directory')
39 program
.parse(process
.argv
);
41 if (!process
.argv
.slice(2).length
) {
43 } else { // https://github.com/tj/commander.js/issues/338
44 // var knownCommand = program.commands.some(function (command) { return command._name === process.argv[2]; });
45 // if (!knownCommand) {
46 // console.error('Unknown command: ' + process.argv[2]);