Skip to content

Commit

Permalink
#391: multiple flags for --data now working
Browse files Browse the repository at this point in the history
  • Loading branch information
binocarlos committed May 8, 2018
1 parent 40d0fc9 commit 43d80f9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/dm/pkg/commands/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func Initialise() {
MainCmd.AddCommand(NewCmdVersion(os.Stdout))
MainCmd.AddCommand(NewCmdMount(os.Stdout))
MainCmd.AddCommand(NewCmdUnmount(os.Stdout))
MainCmd.AddCommand(NewCmdRun(os.Stdout))

MainCmd.PersistentFlags().StringVarP(
&configPath, "config", "c",
Expand Down
38 changes: 38 additions & 0 deletions cmd/dm/pkg/commands/run.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package commands

import (
"fmt"
"io"
"os"

//"github.com/dotmesh-io/dotmesh/cmd/dm/pkg/remotes"
"github.com/spf13/cobra"
)

var runDataVolumes *[]string

func NewCmdRun(out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "run <dot> <mountpoint>",
Short: "Help for dm run.",
Long: `Help for dm run.`,

Run: func(cmd *cobra.Command, args []string) {
err := runJob(cmd, args, out)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
},
}

runDataVolumes = cmd.PersistentFlags().StringSliceP("data", "d", []string{},
"Specify the data dots used for a job run command.")

return cmd
}

func runJob(cmd *cobra.Command, args []string, out io.Writer) error {
fmt.Fprintf(out, "params %+v -- %+v\n", args, runDataVolumes)
return nil
}

0 comments on commit 43d80f9

Please sign in to comment.