aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cli/actions.js9
-rwxr-xr-xcli/surfer.js1
2 files changed, 7 insertions, 3 deletions
diff --git a/cli/actions.js b/cli/actions.js
index 954ca6b..25643da 100644
--- a/cli/actions.js
+++ b/cli/actions.js
@@ -31,17 +31,20 @@ function checkConfig() {
31 console.error('Using server %s', config.server().yellow); 31 console.error('Using server %s', config.server().yellow);
32} 32}
33 33
34function collectFiles(filesOrFolders) { 34function collectFiles(filesOrFolders, options) {
35 var tmp = []; 35 var tmp = [];
36 36
37 filesOrFolders.forEach(function (filePath) { 37 filesOrFolders.forEach(function (filePath) {
38 var baseName = path.basename(filePath);
39 if (!options.all && baseName[0] === '.' && baseName.length > 1) return;
40
38 var stat = fs.statSync(filePath); 41 var stat = fs.statSync(filePath);
39 42
40 if (stat.isFile()) { 43 if (stat.isFile()) {
41 tmp.push(filePath); 44 tmp.push(filePath);
42 } else if (stat.isDirectory()) { 45 } else if (stat.isDirectory()) {
43 var files = fs.readdirSync(filePath).map(function (file) { return path.join(filePath, file); }); 46 var files = fs.readdirSync(filePath).map(function (file) { return path.join(filePath, file); });
44 tmp = tmp.concat(collectFiles(files)); 47 tmp = tmp.concat(collectFiles(files, options));
45 } else { 48 } else {
46 console.log('Skipping %s', filePath.cyan); 49 console.log('Skipping %s', filePath.cyan);
47 } 50 }
@@ -90,7 +93,7 @@ function login(uri) {
90function put(filePath, otherFilePaths, options) { 93function put(filePath, otherFilePaths, options) {
91 checkConfig(); 94 checkConfig();
92 95
93 var files = collectFiles([ filePath ].concat(otherFilePaths)); 96 var files = collectFiles([ filePath ].concat(otherFilePaths), options);
94 97
95 async.eachSeries(files, function (file, callback) { 98 async.eachSeries(files, function (file, callback) {
96 var relativeFilePath; 99 var relativeFilePath;
diff --git a/cli/surfer.js b/cli/surfer.js
index ad37917..8920641 100755
--- a/cli/surfer.js
+++ b/cli/surfer.js
@@ -16,6 +16,7 @@ program.command('login <url>')
16 16
17program.command('put <file> [files...]') 17program.command('put <file> [files...]')
18 .option('-d --destination <folder>', 'Destination folder. This is prepended to the relative <file> path') 18 .option('-d --destination <folder>', 'Destination folder. This is prepended to the relative <file> path')
19 .option('-a --all', 'Also include hidden files and folders.', false)
19 .description('Put a file') 20 .description('Put a file')
20 .action(actions.put); 21 .action(actions.put);
21 22