Commit 15397f71 by Johannes Zellner

Add cli logout command

parent 8fa08229
'use strict';
exports.login = login;
exports.logout = logout;
exports.put = put;
exports.get = get;
exports.del = del;
......@@ -92,6 +93,23 @@ function login(uri) {
});
}
function logout() {
checkConfig();
superagent.post(config.server() + '/api/logout').query(gQuery).end(function (error, result) {
if (result && result.statusCode !== 200) console.log('Failed to logout: ' + result.statusCode);
if (error) console.log(error);
// TODO remove at some point, this is just to clear the previous old version values
config.set('username', '');
config.set('password', '');
config.set('server', '');
config.set('accessToken', '');
console.log('Done'.green);
});
}
function put(filePath, otherFilePaths, options) {
checkConfig();
......
......@@ -11,6 +11,10 @@ program.command('login <url>')
.description('Login to server')
.action(actions.login);
program.command('logout')
.description('Logout from server')
.action(actions.logout);
program.command('put <file> [files...]')
.option('-a --all', 'Also include hidden files and folders.', false)
.description('Put a file, last argument is destination if provided')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment