Skip to content

Commit 53921b1

Browse files
authored
Merge pull request #65 from xm1k3/revert-64-validate-fix
Revert "Validate fix"
2 parents 83ca770 + 6d9486c commit 53921b1

File tree

5 files changed

+481
-72
lines changed

5 files changed

+481
-72
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ after installation run `cent init` to initialize cent with the configuration fil
3535
| init | Cent init configuration file |
3636
| summary | Print summary table |
3737
| update | Update your repository |
38-
| 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. |
38+
| validate | Validate templates, if the template is invalid it is deleted from the folder |
3939
| version | Print cent version |
4040

4141
# Root flags

cmd/validate.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package cmd
66
import (
77
"fmt"
88
"io/ioutil"
9-
"log"
109
"os"
1110
"path/filepath"
1211
"sync"
@@ -23,12 +22,12 @@ var validateCmd = &cobra.Command{
2322
When executed, it scans a specified folder for YAML files. Each YAML file is checked for validity.
2423
If a template is found to be invalid, it is deleted from the folder.`,
2524
Run: func(cmd *cobra.Command, args []string) {
26-
path, _ := cmd.Flags().GetString("path")
25+
path, _ := rootCmd.Flags().GetString("path")
2726

2827
var wg sync.WaitGroup
2928
filepath.Walk(path, func(filePath string, info os.FileInfo, err error) error {
3029
if err != nil {
31-
log.Fatal(err)
30+
return err
3231
}
3332
if info.IsDir() {
3433
} else if filepath.Ext(filePath) == ".yaml" {
@@ -68,6 +67,4 @@ func readFile(filePath string) (string, error) {
6867

6968
func init() {
7069
rootCmd.AddCommand(validateCmd)
71-
validateCmd.Flags().StringP("path", "p", "cent-nuclei-templates", "Root path to save the templates")
72-
7370
}

cmd/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,7 +27,7 @@ var versionCmd = &cobra.Command{
2727
Short: "Print cent version",
2828
Long: "Print cent version",
2929
Run: func(cmd *cobra.Command, args []string) {
30-
fmt.Println("Cent v1.3")
30+
fmt.Println("Cent v1.3.1")
3131
},
3232
}
3333

go.mod

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/xm1k3/cent
33
go 1.19
44

55
require (
6-
github.com/fatih/color v1.16.0
7-
github.com/go-git/go-git/v5 v5.11.0
8-
github.com/hashicorp/go-retryablehttp v0.7.5
6+
github.com/fatih/color v1.15.0
7+
github.com/go-git/go-git/v5 v5.9.0
8+
github.com/hashicorp/go-retryablehttp v0.7.4
99
github.com/jedib0t/go-pretty v4.3.0+incompatible
1010
github.com/mitchellh/go-homedir v1.1.0
11-
github.com/spf13/cobra v1.8.0
12-
github.com/spf13/viper v1.18.1
11+
github.com/spf13/cobra v1.7.0
12+
github.com/spf13/viper v1.17.0
1313
gopkg.in/yaml.v2 v2.4.0
1414
gopkg.in/yaml.v3 v3.0.1
1515
)
@@ -18,15 +18,16 @@ require (
1818
dario.cat/mergo v1.0.0 // indirect
1919
github.com/Microsoft/go-winio v0.6.1 // indirect
2020
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
21+
github.com/acomagu/bufpipe v1.0.4 // indirect
2122
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
2223
github.com/cloudflare/circl v1.3.3 // indirect
2324
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
2425
github.com/emirpasic/gods v1.18.1 // indirect
25-
github.com/fsnotify/fsnotify v1.7.0 // indirect
26+
github.com/fsnotify/fsnotify v1.6.0 // indirect
2627
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
2728
github.com/go-git/go-billy/v5 v5.5.0 // indirect
28-
github.com/go-openapi/errors v0.20.4 // indirect
29-
github.com/go-openapi/strfmt v0.21.9 // indirect
29+
github.com/go-openapi/errors v0.20.3 // indirect
30+
github.com/go-openapi/strfmt v0.21.7 // indirect
3031
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3132
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
3233
github.com/hashicorp/hcl v1.0.0 // indirect
@@ -35,32 +36,32 @@ require (
3536
github.com/kevinburke/ssh_config v1.2.0 // indirect
3637
github.com/magiconair/properties v1.8.7 // indirect
3738
github.com/mattn/go-colorable v0.1.13 // indirect
38-
github.com/mattn/go-isatty v0.0.20 // indirect
39+
github.com/mattn/go-isatty v0.0.17 // indirect
3940
github.com/mattn/go-runewidth v0.0.15 // indirect
4041
github.com/mitchellh/mapstructure v1.5.0 // indirect
4142
github.com/oklog/ulid v1.3.1 // indirect
4243
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
4344
github.com/pjbgf/sha1cd v0.3.0 // indirect
4445
github.com/rivo/uniseg v0.2.0 // indirect
45-
github.com/sagikazarmark/locafero v0.4.0 // indirect
46+
github.com/sagikazarmark/locafero v0.3.0 // indirect
4647
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
4748
github.com/sergi/go-diff v1.1.0 // indirect
48-
github.com/skeema/knownhosts v1.2.1 // indirect
49+
github.com/skeema/knownhosts v1.2.0 // indirect
4950
github.com/sourcegraph/conc v0.3.0 // indirect
50-
github.com/spf13/afero v1.11.0 // indirect
51-
github.com/spf13/cast v1.6.0 // indirect
51+
github.com/spf13/afero v1.10.0 // indirect
52+
github.com/spf13/cast v1.5.1 // indirect
5253
github.com/spf13/pflag v1.0.5 // indirect
5354
github.com/subosito/gotenv v1.6.0 // indirect
5455
github.com/xanzy/ssh-agent v0.3.3 // indirect
55-
go.mongodb.org/mongo-driver v1.13.0 // indirect
56+
go.mongodb.org/mongo-driver v1.11.3 // indirect
5657
go.uber.org/atomic v1.9.0 // indirect
5758
go.uber.org/multierr v1.9.0 // indirect
58-
golang.org/x/crypto v0.16.0 // indirect
59+
golang.org/x/crypto v0.13.0 // indirect
5960
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
6061
golang.org/x/mod v0.12.0 // indirect
61-
golang.org/x/net v0.19.0 // indirect
62-
golang.org/x/sys v0.15.0 // indirect
63-
golang.org/x/text v0.14.0 // indirect
62+
golang.org/x/net v0.15.0 // indirect
63+
golang.org/x/sys v0.12.0 // indirect
64+
golang.org/x/text v0.13.0 // indirect
6465
golang.org/x/tools v0.13.0 // indirect
6566
gopkg.in/ini.v1 v1.67.0 // indirect
6667
gopkg.in/warnings.v0 v0.1.2 // indirect

0 commit comments

Comments
 (0)