From 9f168cff857d271896f9acc0852a84a76151e99b Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Sun, 21 Apr 2024 23:24:38 -0700 Subject: [PATCH] fix lint errors --- Makefile | 6 +++--- README.md | 20 ++++++++++++++++++-- cli_test.go | 8 ++++---- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 617c89b..451cca6 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ LDFLAGS?=--ldflags '-extldflags "-static"' export CGO_ENABLED=0 -build: decl +build: jx -decl: - go build -o decl $(LDFLAGS) ./cmd/cli/main.go +jx: + go build -o jx $(LDFLAGS) ./cmd/cli/main.go test: go test ./... diff --git a/README.md b/README.md index 6f53a1a..5c18d87 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# decl +# jx # Purpose @@ -24,19 +24,35 @@ make build # Update Resource state -`decl -resource-file decl-runner.yaml` +`jx apply decl-runner.yaml` + +Create the resources specified in a resource document HTTP endpoint. + +`jx apply http://localhost/resources` + # Read resource state Read the state of an existing resource (URI) and generate a YAML representation of it. +`jx import -resource file://COPYRIGHT` + ![Import Resource](md-images/import-resource.gif) +Import the contents of a tar archive into a resource document. + +`jx import ./test.tgz` + +Read a resource document from an http endpoint. + +`jx import http://localhost/resources` + # Examples Resources: * [file](examples/file.yaml) [schema](internal/resource/schemas/file.jsonschema) +* [http](examples/http.yaml) [schema](internal/resource/schemas/http.jsonschema) * [user](examples/user.yaml) [schema](internal/resource/schemas/user.jsonschema) * [package](examples/package.yaml) [schema](internal/resource/schemas/package.jsonschema) * [container](examples/container.yaml) [schema](internal/resource/schemas/container.jsonschema) diff --git a/cli_test.go b/cli_test.go index d6a4aa1..80a09c3 100644 --- a/cli_test.go +++ b/cli_test.go @@ -15,10 +15,10 @@ import ( ) func TestCli(t *testing.T) { - if _, e := os.Stat("./decl"); errors.Is(e, os.ErrNotExist) { + if _, e := os.Stat("./jx"); errors.Is(e, os.ErrNotExist) { t.Skip("cli not built") } - yaml, cliErr := exec.Command("./decl", "import", "--resource", "file://COPYRIGHT").Output() + yaml, cliErr := exec.Command("./jx", "import", "--resource", "file://COPYRIGHT").Output() slog.Info("TestCli", "err", cliErr) assert.Nil(t, cliErr) assert.NotEqual(t, "", string(yaml)) @@ -26,7 +26,7 @@ func TestCli(t *testing.T) { } func TestCliHTTPSource(t *testing.T) { - if _, e := os.Stat("./decl"); errors.Is(e, os.ErrNotExist) { + if _, e := os.Stat("./jx"); errors.Is(e, os.ErrNotExist) { t.Skip("cli not built") } ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -46,7 +46,7 @@ resources: })) defer ts.Close() - yaml, cliErr := exec.Command("./decl", "import", "--resource", ts.URL).Output() + yaml, cliErr := exec.Command("./jx", "import", "--resource", ts.URL).Output() slog.Info("TestCliHTTPSource", "err", cliErr) assert.Nil(t, cliErr) assert.NotEqual(t, "", string(yaml))