Skip to content

Commit

Permalink
Merge pull request #65 from xm1k3/revert-64-validate-fix
Browse files Browse the repository at this point in the history
Revert "Validate fix"
  • Loading branch information
xm1k3 authored Dec 12, 2023
2 parents 83ca770 + 6d9486c commit 53921b1
Show file tree
Hide file tree
Showing 5 changed files with 481 additions and 72 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ after installation run `cent init` to initialize cent with the configuration fil
| init | Cent init configuration file |
| summary | Print summary table |
| update | Update your repository |
| validate | The validate command is a part of the application's functionality to validate templates. When executed, it scans a specified folder for YAML files. Each YAML file is checked for validity. If a template is found to be invalid, it is deleted from the folder. |
| validate | Validate templates, if the template is invalid it is deleted from the folder |
| version | Print cent version |

# Root flags
Expand Down
7 changes: 2 additions & 5 deletions cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cmd
import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"sync"
Expand All @@ -23,12 +22,12 @@ var validateCmd = &cobra.Command{
When executed, it scans a specified folder for YAML files. Each YAML file is checked for validity.
If a template is found to be invalid, it is deleted from the folder.`,
Run: func(cmd *cobra.Command, args []string) {
path, _ := cmd.Flags().GetString("path")
path, _ := rootCmd.Flags().GetString("path")

var wg sync.WaitGroup
filepath.Walk(path, func(filePath string, info os.FileInfo, err error) error {
if err != nil {
log.Fatal(err)
return err
}
if info.IsDir() {
} else if filepath.Ext(filePath) == ".yaml" {
Expand Down Expand Up @@ -68,6 +67,4 @@ func readFile(filePath string) (string, error) {

func init() {
rootCmd.AddCommand(validateCmd)
validateCmd.Flags().StringP("path", "p", "cent-nuclei-templates", "Root path to save the templates")

}
4 changes: 2 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -27,7 +27,7 @@ var versionCmd = &cobra.Command{
Short: "Print cent version",
Long: "Print cent version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Cent v1.3")
fmt.Println("Cent v1.3.1")
},
}

Expand Down
37 changes: 19 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module github.com/xm1k3/cent
go 1.19

require (
github.com/fatih/color v1.16.0
github.com/go-git/go-git/v5 v5.11.0
github.com/hashicorp/go-retryablehttp v0.7.5
github.com/fatih/color v1.15.0
github.com/go-git/go-git/v5 v5.9.0
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.1
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.17.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -18,15 +18,16 @@ require (
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-openapi/errors v0.20.4 // indirect
github.com/go-openapi/strfmt v0.21.9 // indirect
github.com/go-openapi/errors v0.20.3 // indirect
github.com/go-openapi/strfmt v0.21.7 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand All @@ -35,32 +36,32 @@ require (
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/skeema/knownhosts v1.2.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.mongodb.org/mongo-driver v1.13.0 // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.13.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
Expand Down
Loading

0 comments on commit 53921b1

Please sign in to comment.