diff --git a/command/fs_list.go b/command/fs_list.go index 1b3880816..da51ee31c 100644 --- a/command/fs_list.go +++ b/command/fs_list.go @@ -96,12 +96,14 @@ func (f *FSListCommand) Run(args []string) int { } } + // Ge the file at the given path files, _, err := client.AllocFS().List(alloc, path, nil) if err != nil { f.Ui.Error(fmt.Sprintf("Error listing alloc dir: %v", err)) return 1 } + // Display the file information in a tabular format out := make([]string, len(files)+1) out[0] = "Name|Size" for i, file := range files { diff --git a/command/fs_readat.go b/command/fs_readat.go index d5990505b..d90041eb2 100644 --- a/command/fs_readat.go +++ b/command/fs_readat.go @@ -97,6 +97,7 @@ func (f *FSCatCommand) Run(args []string) int { } } + // Stat the file to find it's size file, _, err := client.AllocFS().Stat(alloc, path, nil) if err != nil { f.Ui.Error(fmt.Sprintf("Error stating file: %v:", err)) @@ -107,6 +108,7 @@ func (f *FSCatCommand) Run(args []string) int { return 1 } + // Get the contents of the file offset := 0 limit := file.Size if _, err := client.AllocFS().ReadAt(alloc, path, int64(offset), limit, os.Stdout, nil); err != nil { diff --git a/command/fs_stat.go b/command/fs_stat.go index 5029f8e19..db8368d19 100644 --- a/command/fs_stat.go +++ b/command/fs_stat.go @@ -96,12 +96,14 @@ func (f *FSStatCommand) Run(args []string) int { } } + // Get the file information file, _, err := client.AllocFS().Stat(alloc, path, nil) if err != nil { f.Ui.Error(fmt.Sprintf("Error stating file: %v:", err)) return 1 } + // Display the file information out := make([]string, 2) out[0] = "Name|Size" if file != nil {