aboutsummaryrefslogtreecommitdiffhomepage
path: root/cli
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@nebulon.de>2015-11-30 15:59:23 +0100
committerJohannes Zellner <johannes@nebulon.de>2015-11-30 15:59:23 +0100
commitd53a1669766a1a77bda34ee52109bee9c8735bda (patch)
tree73d1a3f3b567b0de51f74b9277f666aee3f9ea94 /cli
parentde9b8cee3bcace729c59fca1cebea2d33fc64514 (diff)
downloadSurfer-d53a1669766a1a77bda34ee52109bee9c8735bda.tar.gz
Surfer-d53a1669766a1a77bda34ee52109bee9c8735bda.tar.zst
Surfer-d53a1669766a1a77bda34ee52109bee9c8735bda.zip
Do not include hidden folders by default
Diffstat (limited to 'cli')
-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