Commit d53a1669 by Johannes Zellner

Do not include hidden folders by default

1 parent de9b8cee
Showing with 7 additions and 3 deletions
......@@ -31,17 +31,20 @@ function checkConfig() {
console.error('Using server %s', config.server().yellow);
}
function collectFiles(filesOrFolders) {
function collectFiles(filesOrFolders, options) {
var tmp = [];
filesOrFolders.forEach(function (filePath) {
var baseName = path.basename(filePath);
if (!options.all && baseName[0] === '.' && baseName.length > 1) return;
var stat = fs.statSync(filePath);
if (stat.isFile()) {
tmp.push(filePath);
} else if (stat.isDirectory()) {
var files = fs.readdirSync(filePath).map(function (file) { return path.join(filePath, file); });
tmp = tmp.concat(collectFiles(files));
tmp = tmp.concat(collectFiles(files, options));
} else {
console.log('Skipping %s', filePath.cyan);
}
......@@ -90,7 +93,7 @@ function login(uri) {
function put(filePath, otherFilePaths, options) {
checkConfig();
var files = collectFiles([ filePath ].concat(otherFilePaths));
var files = collectFiles([ filePath ].concat(otherFilePaths), options);
async.eachSeries(files, function (file, callback) {
var relativeFilePath;
......
......@@ -16,6 +16,7 @@ program.command('login <url>')
program.command('put <file> [files...]')
.option('-d --destination <folder>', 'Destination folder. This is prepended to the relative <file> path')
.option('-a --all', 'Also include hidden files and folders.', false)
.description('Put a file')
.action(actions.put);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!