<commit_before>package main

import (
	"fmt"
	"os"

	"github.com/codegangsta/cli"
	"github.com/kunalkushwaha/octool/plugins"
	_ "github.com/kunalkushwaha/octool/plugins/linux"
)

func main() {

	app := cli.NewApp()
	app.Name = "octool"
	app.Usage = "Toolchain for OpenContainer Format"
	app.Version = "0.1.0"
	app.Commands = []cli.Command{
		{
			Name:  "validate",
			Usage: "validate container image / Json",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "json",
					Usage: "json config file to validate",
				},
				cli.StringFlag{
					Name:  "os",
					Usage: "Target OS",
				},
			},
			Action: validateOCImage,
		},
		{
			Name:  "test",
			Usage: "Test the Container",
			//Action: testOContainer,
		},
	}

	app.Run(os.Args)
}

func validateOCImage(c *cli.Context) {
	configJson := c.String("json")
	//os := c.String("os")

	if len(configJson) == 0 {
		cli.ShowCommandHelp(c, "validate")
		return
	}
	plugin, err := plugin.NewPlugin("linux", "test.json")
	if err != nil {
		fmt.Println(err)
		return
	}
	errors, valid := plugin.ValidatePluginSpecs()
	if !valid {
		for _, err := range errors {
			fmt.Println(err)<commit_msg>Bug Fix of hardcode json file and os<commit_after>package main

import (
	"fmt"
	"os"

	"github.com/codegangsta/cli"
	"github.com/kunalkushwaha/octool/plugins"
	_ "github.com/kunalkushwaha/octool/plugins/linux"
)

func main() {

	app := cli.NewApp()
	app.Name = "octool"
	app.Usage = "Toolchain for OpenContainer Format"
	app.Version = "0.1.0"
	app.Commands = []cli.Command{
		{
			Name:  "validate",
			Usage: "validate container image / Json",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "json",
					Usage: "json config file to validate",
				},
				cli.StringFlag{
					Name:  "os",
					Usage: "Target OS",
				},
			},
			Action: validateOCImage,
		},
		{
			Name:  "test",
			Usage: "Test the Container",
			//Action: testOContainer,
		},
	}

	app.Run(os.Args)
}

func validateOCImage(c *cli.Context) {
	configJson := c.String("json")
	os := c.String("os")

	if len(configJson) == 0 {
		cli.ShowCommandHelp(c, "validate")
		return
	}

	if len(os) == 0 {
		//FIXME: Instead of default as linux, detect os
		os = "linux"
	}

	plugin, err := plugin.NewPlugin(os, configJson)
	if err != nil {
		fmt.Println(err)
		return
	}
	errors, valid := plugin.ValidatePluginSpecs()
	if !valid {
		for _, err := range errors {
			fmt.Println(err)
{'fraction_non_alphanumeric': 0.1598326359832636, 'fraction_numerical': 0.0037656903765690376, 'mean_word_length': 3.1082474226804124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4371134', 'n_tokens_mistral': 1035, 'n_tokens_neox': 910, 'n_words': 199}