mirror of https://github.com/databricks/cli.git
changed alias to a function
This commit is contained in:
parent
c3bc6fd540
commit
95d8590e81
15
cmd/fs/ls.go
15
cmd/fs/ls.go
|
@ -9,10 +9,9 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileInfo filer.FileInfo
|
func expandPath(i filer.FileInfo, root string) filer.FileInfo {
|
||||||
|
|
||||||
func (i *FileInfo) ExpandPath(root string) {
|
|
||||||
i.Name = path.Join(root, i.Name)
|
i.Name = path.Join(root, i.Name)
|
||||||
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
// lsCmd represents the ls command
|
// lsCmd represents the ls command
|
||||||
|
@ -58,14 +57,12 @@ var lsCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute output with expanded paths if necessary
|
// compute output with expanded paths if necessary
|
||||||
output := make([]FileInfo, len(filesInfo))
|
if absolute {
|
||||||
for i, v := range filesInfo {
|
for i := range filesInfo {
|
||||||
output[i] = FileInfo(v)
|
filesInfo[i] = expandPath(filesInfo[i], rootPath)
|
||||||
if absolute {
|
|
||||||
output[i].ExpandPath(rootPath)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cmdio.RenderWithTemplate(ctx, output, template)
|
return cmdio.RenderWithTemplate(ctx, filesInfo, template)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue