remove drone-hugo validate arg

The dependence of drone-hugo validate, hugo check, was removed since v0.92.0.
  As the hugo check does nothing in fact, a removal of command validate
  could be considered.

  - removed command validate in main.go and plugin_test.go
  - removed unused github.com/pkg/errors in plugin_test.go
This commit is contained in:
AzurCrystal 2022-08-03 00:12:34 +08:00
parent 3e380a7ddf
commit 5bb893c04e
2 changed files with 0 additions and 35 deletions

View File

@ -81,11 +81,6 @@ func main() {
EnvVar: "PLUGIN_URL",
Value: "",
},
cli.BoolFlag{
Name: "validate",
Usage: "validate config file before generation",
EnvVar: "PLUGIN_VALIDATE",
},
cli.StringFlag{
Name: "hugoversion",
Usage: "the hugo version to be used",
@ -110,7 +105,6 @@ func run(c *cli.Context) error {
Drafts: c.Bool("drafts"),
Expired: c.Bool("expired"),
Future: c.Bool("future"),
Validate: c.Bool("validate"),
Config: c.String("config"),
Content: c.String("content"),
Layout: c.String("layout"),

View File

@ -2,28 +2,8 @@ package main
import (
"testing"
"github.com/pkg/errors"
)
func TestCommandValidate(t *testing.T) {
config := Config{Validate: true}
want := []string{"hugo", "check"}
got := commandValidate(config)
if err := argsEqual(want, got.Args); err != nil {
t.Errorf("%s", err)
}
config = Config{Validate: true, Config: "config.toml"}
want = []string{"hugo", "check", "--config", "config.toml"}
got = commandValidate(config)
if err := argsEqual(want, got.Args); err != nil {
t.Errorf("%s", err)
}
}
func TestVersionEqual(t *testing.T) {
want := true
if got := versionsEqual("1.0", "1.0"); want != got {
@ -35,12 +15,3 @@ func TestVersionEqual(t *testing.T) {
t.Errorf("want: %t, got: %t", want, got)
}
}
func argsEqual(want []string, got []string) error {
for i := range want {
if want[i] != got[i] {
return errors.Errorf("Arguments do not match, want: %s, got: %s", want[i], got[i])
}
}
return nil
}