|
|
@ -17,8 +17,10 @@ limitations under the License.
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
"bufio"
|
|
|
|
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// loadCmd represents the load command
|
|
|
|
// loadCmd represents the load command
|
|
|
@ -34,6 +36,7 @@ var loadCmd = &cobra.Command{
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
fmt.Println("load called")
|
|
|
|
fmt.Println("load called")
|
|
|
|
fmt.Println("Inputfile: ",inputFilename)
|
|
|
|
fmt.Println("Inputfile: ",inputFilename)
|
|
|
|
|
|
|
|
loadFile()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -50,3 +53,25 @@ func init() {
|
|
|
|
// is called directly, e.g.:
|
|
|
|
// is called directly, e.g.:
|
|
|
|
// loadCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
|
|
|
// loadCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func loadFile() {
|
|
|
|
|
|
|
|
file, err := os.Open(inputFilename)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Fatalf("failed opening file: %s", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanner := bufio.NewScanner(file)
|
|
|
|
|
|
|
|
scanner.Split(bufio.ScanLines)
|
|
|
|
|
|
|
|
var txtlines []string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for scanner.Scan() {
|
|
|
|
|
|
|
|
txtlines = append(txtlines, scanner.Text())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file.Close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for _, eachline := range txtlines {
|
|
|
|
|
|
|
|
fmt.Println(eachline)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|