Display fs in nomad help and list the subcommands when called

This commit is contained in:
Alex Dadgar 2016-02-05 11:01:29 -08:00
parent fc20467594
commit 76a11b4613
6 changed files with 27 additions and 3 deletions

19
command/fs.go Normal file
View file

@ -0,0 +1,19 @@
package command
import "github.com/mitchellh/cli"
type FSCommand struct {
Meta
}
func (f *FSCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
}
func (f *FSCommand) Synopsis() string {
return "Inspect the contents of an allocation directory"
}
func (f *FSCommand) Run(args []string) int {
return cli.RunResultHelp
}

View file

@ -29,7 +29,7 @@ func (f *FSCatCommand) Help() string {
} }
func (f *FSCatCommand) Synopsis() string { func (f *FSCatCommand) Synopsis() string {
return "displays a file at a given location" return "Cat a file in an allocation directory"
} }
func (f *FSCatCommand) Run(args []string) int { func (f *FSCatCommand) Run(args []string) int {

View file

@ -28,7 +28,7 @@ Usage: nomad fs ls <alloc-id> <path>
} }
func (f *FSListCommand) Synopsis() string { func (f *FSListCommand) Synopsis() string {
return "Lists list of files of an allocation directory" return "List files in an allocation directory"
} }
func (f *FSListCommand) Run(args []string) int { func (f *FSListCommand) Run(args []string) int {

View file

@ -27,7 +27,7 @@ Usage: nomad fs stat <alloc-id> <path>
} }
func (f *FSStatCommand) Synopsis() string { func (f *FSStatCommand) Synopsis() string {
return "Stats an entry in an allocation directory" return "Stat an entry in an allocation directory"
} }
func (f *FSStatCommand) Run(args []string) int { func (f *FSStatCommand) Run(args []string) int {

View file

@ -57,6 +57,11 @@ func Commands(metaPtr *command.Meta) map[string]cli.CommandFactory {
Meta: meta, Meta: meta,
}, nil }, nil
}, },
"fs": func() (cli.Command, error) {
return &command.FSCommand{
Meta: meta,
}, nil
},
"fs ls": func() (cli.Command, error) { "fs ls": func() (cli.Command, error) {
return &command.FSListCommand{ return &command.FSListCommand{
Meta: meta, Meta: meta,

0
main.go Executable file → Normal file
View file