Skip to content

Commit

Permalink
flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan-Zamfir committed Jun 8, 2024
1 parent 1ce758a commit 82c6adf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 6 additions & 3 deletions cli/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ var normalizeCmd = &cobra.Command{
if err != nil {
log.Fatal(err)
}
var exportFilePath string

//res := "dataNM.csv"
//ExportToFile(res, exportFilePath)
res := "dataNM.csv" // need to pass in file, not name
ExportToFile(res, exportFilePath) // need to pass in file, not name
},
}

func init() {
rootCmd.AddCommand(normalizeCmd)
//normalizeCmd.Flags().StringVarP(&exportFilePath, "export", "e", "", "Export to filepath -> (provide path)")
var exportFilePath string

normalizeCmd.Flags().StringVarP(&exportFilePath, "export", "e", "", "Export to filepath -> (provide path)")
}
9 changes: 5 additions & 4 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command {
Use: "norm",
var rootCmd = &cobra.Command{
Use: "norm",
Short: "Normalize csv data for ML",
Long: "This tool lets you enter a csv file and returns normalized/standardized data for ML",
Long: "This tool lets you enter a csv file and returns normalized/standardized data for ML",
}

// executes root command
func Execute() {

if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
Expand All @@ -23,4 +24,4 @@ func Execute() {

func init() {
//define flags and config settings
}
}
2 changes: 1 addition & 1 deletion cli/standardise.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ var standardiseCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(standardiseCmd)
//standardiseCmd.Flags().StringVarP(&exportFilePath, "export", "e", "", "Export to filepath -> (provide path)")
//standardiseCmd.PersistentFlags().String("filepath", "export", "Export to filepath -> (provide path)")
}

0 comments on commit 82c6adf

Please sign in to comment.