Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
PUBLIC
/
surfer-okd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d53a1669
authored
9 years ago
by
Johannes Zellner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not include hidden folders by default
1 parent
de9b8cee
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
cli/actions.js
cli/surfer.js
cli/actions.js
View file @
d53a166
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
cli/surfer.js
View file @
d53a166
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment