Commit 99271f1e authored by Bruce Flynn's avatar Bruce Flynn
Browse files

reutrn isdir and perms from listdir

parent 63aa341e
......@@ -182,6 +182,8 @@ type stat struct {
Name string `json:"name"`
Size int64 `json:"size"`
MTime int64 `json:"mtime"`
Dir bool `json:"isdir"`
Perms uint32 `json:"perms"`
}
// args: abspath glob pattern
......@@ -195,7 +197,13 @@ func (s sftpAPI) doListdir(path string) ([]stat, error) {
}
for _, st := range infos {
stats = append(stats, stat{st.Name(), st.Size(), st.ModTime().Unix()})
stats = append(stats, stat{
st.Name(),
st.Size(),
st.ModTime().Unix(),
st.IsDir(),
uint32(st.Mode().Perm()),
})
}
return stats, nil
......@@ -373,7 +381,7 @@ func newSftpConfig(user, keyFile, hostKey string) (ssh.ClientConfig, error) {
return cfg, nil
}
func newSftpApi(url, privateKey, hostKey string, req io.Reader, resp io.Writer) (sftpAPI, error) {
func newSFTPAPI(url, privateKey, hostKey string, req io.Reader, resp io.Writer) (sftpAPI, error) {
var err error
sftp := sftpAPI{
......
......@@ -86,7 +86,7 @@ https://gitlab.ssec.wisc.edu/brucef/sftper
}
}
sftp, err := newSftpApi(pflag.Arg(0), *pKey, *hKey, input, os.Stdout)
sftp, err := newSFTPAPI(pflag.Arg(0), *pKey, *hKey, input, os.Stdout)
if err != nil {
info("could not initialize api: %s", err)
os.Exit(2)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment