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
Nov 30, 2015
by
Johannes Zellner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not include hidden folders by default
1 parent
de9b8cee
Hide 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() {
...
@@ -31,17 +31,20 @@ function checkConfig() {
console
.
error
(
'Using server %s'
,
config
.
server
().
yellow
);
console
.
error
(
'Using server %s'
,
config
.
server
().
yellow
);
}
}
function
collectFiles
(
filesOrFolders
)
{
function
collectFiles
(
filesOrFolders
,
options
)
{
var
tmp
=
[];
var
tmp
=
[];
filesOrFolders
.
forEach
(
function
(
filePath
)
{
filesOrFolders
.
forEach
(
function
(
filePath
)
{
var
baseName
=
path
.
basename
(
filePath
);
if
(
!
options
.
all
&&
baseName
[
0
]
===
'.'
&&
baseName
.
length
>
1
)
return
;
var
stat
=
fs
.
statSync
(
filePath
);
var
stat
=
fs
.
statSync
(
filePath
);
if
(
stat
.
isFile
())
{
if
(
stat
.
isFile
())
{
tmp
.
push
(
filePath
);
tmp
.
push
(
filePath
);
}
else
if
(
stat
.
isDirectory
())
{
}
else
if
(
stat
.
isDirectory
())
{
var
files
=
fs
.
readdirSync
(
filePath
).
map
(
function
(
file
)
{
return
path
.
join
(
filePath
,
file
);
});
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
{
}
else
{
console
.
log
(
'Skipping %s'
,
filePath
.
cyan
);
console
.
log
(
'Skipping %s'
,
filePath
.
cyan
);
}
}
...
@@ -90,7 +93,7 @@ function login(uri) {
...
@@ -90,7 +93,7 @@ function login(uri) {
function
put
(
filePath
,
otherFilePaths
,
options
)
{
function
put
(
filePath
,
otherFilePaths
,
options
)
{
checkConfig
();
checkConfig
();
var
files
=
collectFiles
([
filePath
].
concat
(
otherFilePaths
));
var
files
=
collectFiles
([
filePath
].
concat
(
otherFilePaths
)
,
options
);
async
.
eachSeries
(
files
,
function
(
file
,
callback
)
{
async
.
eachSeries
(
files
,
function
(
file
,
callback
)
{
var
relativeFilePath
;
var
relativeFilePath
;
...
...
cli/surfer.js
View file @
d53a166
...
@@ -16,6 +16,7 @@ program.command('login <url>')
...
@@ -16,6 +16,7 @@ program.command('login <url>')
program
.
command
(
'put <file> [files...]'
)
program
.
command
(
'put <file> [files...]'
)
.
option
(
'-d --destination <folder>'
,
'Destination folder. This is prepended to the relative <file> path'
)
.
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'
)
.
description
(
'Put a file'
)
.
action
(
actions
.
put
);
.
action
(
actions
.
put
);
...
...
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