X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=cli%2Factions.js;h=00ffb6fba0663362f9b946ff9ec03d55f5d404dc;hb=eb83e4daa3726d3e7f12c513a19d212b709dadff;hp=592d8090193f39e2ca4f66b0afba341ded2f4b7e;hpb=8c3ae0719e1f7d266ee04d86e7e1c3756745d372;p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git diff --git a/cli/actions.js b/cli/actions.js index 592d809..00ffb6f 100644 --- a/cli/actions.js +++ b/cli/actions.js @@ -46,7 +46,7 @@ function login(server) { config.set('server', server); } -function put(filePath, otherFilePaths) { +function put(filePath, otherFilePaths, options) { checkConfig(); var files = collectFiles([ filePath ].concat(otherFilePaths)); @@ -54,7 +54,7 @@ function put(filePath, otherFilePaths) { async.eachSeries(files, function (file, callback) { var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); - console.log('Uploading file %s', relativeFilePath.cyan); + console.log('Uploading file %s -> %s', relativeFilePath.cyan, ((options.destination ? options.destination : '') + '/' + relativeFilePath).cyan); superagent.put(config.server() + API + relativeFilePath).attach('file', file).end(callback); }, function (error) { @@ -90,6 +90,7 @@ function del(filePath) { var relativeFilePath = path.resolve(filePath).slice(process.cwd().length + 1); superagent.del(config.server() + API + relativeFilePath).end(function (error, result) { + if (error.status === 404) return console.log('No such file or directory'); if (error) return console.log('Failed', result ? result.body : error); console.log('Success', result.body); });