Skip to content

Commit

Permalink
data info no arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jbenet committed Jan 7, 2014
1 parent fd4222b commit c596100
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions data_info.go
Expand Up @@ -6,29 +6,29 @@ import (
)

var cmd_data_info = &commander.Command{
UsageLine: "info <dataset>",
UsageLine: "info [<dataset>]",
Short: "Show dataset information.",
Long: `data info - Show dataset information.
Returns the Datafile corresponding to <dataset> and exits.
Returns the Datafile corresponding to <dataset> (or in current
directory) and exits.
`,
Run: infoCmd,
}

func infoCmd(c *commander.Command, args []string) error {
if len(args) < 1 {

return fmt.Errorf("%v requires a <dataset> argument.", c.FullName())
return datasetInfo(DatafileName)
}

return datasetInfo(args[0])
return datasetInfo(DatafilePath(args[0]))
}

func datasetInfo(dataset string) error {
df, err := NewDatafile(DatafilePath(dataset))
func datasetInfo(path string) error {
df, err := NewDatafile(path)
if err != nil {
dErr("Error: %s\n", err)
return fmt.Errorf("Invalid dataset handle: %s", dataset)
return fmt.Errorf("Invalid dataset path: %s", path)
}

buf, err := df.Marshal()
Expand Down

0 comments on commit c596100

Please sign in to comment.