diff options
Diffstat (limited to 'cli/actions.js')
-rw-r--r-- | cli/actions.js | 5 |
1 files changed, 3 insertions, 2 deletions
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) { | |||
46 | config.set('server', server); | 46 | config.set('server', server); |
47 | } | 47 | } |
48 | 48 | ||
49 | function put(filePath, otherFilePaths) { | 49 | function put(filePath, otherFilePaths, options) { |
50 | checkConfig(); | 50 | checkConfig(); |
51 | 51 | ||
52 | var files = collectFiles([ filePath ].concat(otherFilePaths)); | 52 | var files = collectFiles([ filePath ].concat(otherFilePaths)); |
@@ -54,7 +54,7 @@ function put(filePath, otherFilePaths) { | |||
54 | async.eachSeries(files, function (file, callback) { | 54 | async.eachSeries(files, function (file, callback) { |
55 | var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); | 55 | var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); |
56 | 56 | ||
57 | console.log('Uploading file %s', relativeFilePath.cyan); | 57 | console.log('Uploading file %s -> %s', relativeFilePath.cyan, ((options.destination ? options.destination : '') + '/' + relativeFilePath).cyan); |
58 | 58 | ||
59 | superagent.put(config.server() + API + relativeFilePath).attach('file', file).end(callback); | 59 | superagent.put(config.server() + API + relativeFilePath).attach('file', file).end(callback); |
60 | }, function (error) { | 60 | }, function (error) { |
@@ -90,6 +90,7 @@ function del(filePath) { | |||
90 | 90 | ||
91 | var relativeFilePath = path.resolve(filePath).slice(process.cwd().length + 1); | 91 | var relativeFilePath = path.resolve(filePath).slice(process.cwd().length + 1); |
92 | superagent.del(config.server() + API + relativeFilePath).end(function (error, result) { | 92 | superagent.del(config.server() + API + relativeFilePath).end(function (error, result) { |
93 | if (error.status === 404) return console.log('No such file or directory'); | ||
93 | if (error) return console.log('Failed', result ? result.body : error); | 94 | if (error) return console.log('Failed', result ? result.body : error); |
94 | console.log('Success', result.body); | 95 | console.log('Success', result.body); |
95 | }); | 96 | }); |