cmd

package
v0.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChkCmd = &cobra.Command{
	Use:     "chk",
	Aliases: []string{"check"},
	Short:   "Run checkers",
	Long:    `Check all code standards for coding conventions`,
	Run: func(cmd *cobra.Command, args []string) {
		err := crieRun.Run("chk")

		if err != nil {
			log.Fatal(err)
		}
	},
}

ChkCmd Run all code checking commands

View Source
var ConfCmd = &cobra.Command{
	Use:     "conf",
	Aliases: []string{"config", "cnf"},
	Short:   "Print what crie has parsed from flags, env, the project file, and then defaults",
	Long:    "Print what crie has parsed from flags, env, the project file, and then defaults",
	RunE: func(_ *cobra.Command, _ []string) error {
		var projectConfig project.Config
		err := viper.Unmarshal(&projectConfig)
		if err != nil {
			return err
		}
		marshal, err := yaml.Marshal(projectConfig)
		if err != nil {
			return err
		}

		fmt.Println(string(marshal))
		return nil
	},
}

ConfCmd is used to show configuration settings after flags, env, configs are parsed

View Source
var FmtCmd = &cobra.Command{
	Use:   "fmt",
	Short: "Run formatters",
	Long:  `Run all formatters in the list`,
	Run: func(cmd *cobra.Command, args []string) {
		err := crieRun.Run("fmt")

		if err != nil {
			log.Fatal(err)
		}
	},
}

FmtCmd Format code command

View Source
var InitCmd = &cobra.Command{
	Use:   "init",
	Short: "Create an optional project project file",
	Long:  `Create an optional project project file`,

	RunE: func(_ *cobra.Command, _ []string) error {

		err := language.NewLanguageConfigFile(viper.GetString("languageConfigPath"))
		if err != nil {
			return err
		}
		fmt.Printf("new language file created: %s\nused to overide crie internal language settings (optional / can be deleted)\n", viper.GetString("languageConfigPath"))

		fmt.Println()

		var projectConfig project.Config
		err = viper.Unmarshal(&projectConfig)
		if err != nil {
			return err
		}
		err = projectConfig.NewProjectConfigFile(viper.GetString("projectConfigPath"))
		if err != nil {
			log.Fatal(err)
		}
		fmt.Printf("new project file created: %s\nthis will be treated as your project defaults (overiden by flags and env)\n", viper.GetString("projectConfigPath"))
		return nil
	},
}

InitCmd command will create a project project file for crieRun

View Source
var LntCmd = &cobra.Command{
	Use:     "lnt",
	Aliases: []string{"lint", "all"},
	Short:   "Run everything",
	Long:    `Runs both format and then check`,
	Run: func(_ *cobra.Command, _ []string) {
		stage("fmt")
		stage("chk")
	},
}

LntCmd Runs all commands

View Source
var LsCmd = &cobra.Command{
	Use:     "ls",
	Aliases: []string{"list"},
	Short:   "List languages",
	Long:    `List all languages available and the commands run when used`,
	Run: func(cmd *cobra.Command, args []string) {
		crieRun.List()
	},
}

LsCmd List support languages command

View Source
var NonCmd = &cobra.Command{
	Use:     "non",
	Aliases: []string{"not-linted"},
	Short:   "List what isn't supported for this project",
	Long: `List what isn't supported for this project

Find the file extensions that dont have an associated regex match within crieRun`,
	Run: func(cmd *cobra.Command, args []string) {
		crieRun.NoStandards()
	},
}

NonCmd List every type of file that just passes through

View Source
var SchemaCmd = &cobra.Command{
	Use:     "schema",
	Aliases: []string{"sch"},
	Short:   "Print jsonschema's of the crie cli configs",
	Long:    `Print jsonschema's' of the crie cli configs`,
}

SchemaCmd is used to hold jsonschema generator commands

View Source
var SchemaLangCmd = &cobra.Command{
	Use:     "lang",
	Aliases: []string{"language", "lng"},
	Short:   "Print the schema for language's configurations",
	Long:    `Print json schema for cries configuration format used override language project`,
	Run: func(_ *cobra.Command, _ []string) {
		schema := language.Schema()
		jsonBytes, err := json.MarshalIndent(schema, "", "  ")
		if err != nil {
			return
		}
		fmt.Println(string(jsonBytes))
	},
}

SchemaLangCmd is the jsonschema generator for the crie languages configuration

View Source
var SchemaProjectCmd = &cobra.Command{
	Use:     "proj",
	Aliases: []string{"project", "prj"},
	Short:   "Print the schema for language's configurations",
	Long:    `Print json schema for cries configuration format used override language project`,
	Run: func(_ *cobra.Command, _ []string) {
		schema := project.Schema()
		jsonBytes, err := json.MarshalIndent(schema, "", "  ")
		if err != nil {
			return
		}
		fmt.Println(string(jsonBytes))
	},
}

SchemaProjectCmd is the jsonschema generator for the crie project configuration

Functions

func SaveConfiguration added in v0.20.2

func SaveConfiguration(proj *project.Config, langs *language.Languages) crie.RunConfiguration

SaveConfiguration pushes the Languages to the crie.RunConfiguration

func SetCrie added in v0.20.2

func SetCrie(cr crie.RunConfiguration)

SetCrie is used to ensure the entire crie configuration is set together

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL