Display fs in nomad help and list the subcommands when called
This commit is contained in:
parent
fc20467594
commit
76a11b4613
19
command/fs.go
Normal file
19
command/fs.go
Normal 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
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue