From eafd5ebb043f9538ea81b4d6ca292ca23c23b581 Mon Sep 17 00:00:00 2001 From: Sasha Melentyev Date: Tue, 1 Feb 2022 20:09:45 +0300 Subject: [PATCH] feat: add alias and more examples --- .cligen.yml | 1 + README.md | 4 ++-- cmd/dummy/main.go | 1 + examples/README.md | 13 +++++++++++++ examples/docker/Dockerfile | 2 +- examples/docker/{openapi3.yml => openapi.yml} | 0 6 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 examples/README.md rename examples/docker/{openapi3.yml => openapi.yml} (100%) diff --git a/.cligen.yml b/.cligen.yml index 5a0e12a..7dd47f0 100644 --- a/.cligen.yml +++ b/.cligen.yml @@ -1,4 +1,5 @@ name: "Dummy" commands: - name: "server" + alias: "s" description: "run mock server" diff --git a/README.md b/README.md index aa3282a..134e0da 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,10 @@ go install github.com/go-dummy/dummy/cmd/dummy@latest ## Usage Dummy can help you run mock server based off an API contract, which helps people see how your API will work before you even have it built. Run it locally with the `dummy server` command to run your API on a HTTP server you can interact with. ```shell -dummy server ./openapi.yml +dummy s openapi.yml ``` ```shell -dummy server https://raw.githubusercontent.com/go-dummy/dummy/main/examples/docker/openapi3.yml +dummy s https://raw.githubusercontent.com/go-dummy/dummy/main/examples/docker/openapi.yml ``` More usage [examples](examples) diff --git a/cmd/dummy/main.go b/cmd/dummy/main.go index 42ee55b..25f5593 100644 --- a/cmd/dummy/main.go +++ b/cmd/dummy/main.go @@ -32,6 +32,7 @@ func run() error { cmds := []acmd.Command{ { Name: "server", + Alias: "s", Description: "run mock server", Do: func(ctx context.Context, args []string) error { cfg := config.NewConfig() diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..23caccc --- /dev/null +++ b/examples/README.md @@ -0,0 +1,13 @@ +## Usage +```shell +dummy s openapi.yml +``` +```shell +dummy server openapi.yml +``` +```shell +dummy s openapi.json +``` +```shell +dummy s https://raw.githubusercontent.com/go-dummy/dummy/main/examples/docker/openapi.yml +``` diff --git a/examples/docker/Dockerfile b/examples/docker/Dockerfile index e5110f4..2628141 100644 --- a/examples/docker/Dockerfile +++ b/examples/docker/Dockerfile @@ -6,4 +6,4 @@ COPY ./openapi3.yml . WORKDIR . -CMD ["dummy", "server", "openapi3.yml", "-port=8080"] +CMD ["dummy", "s", "openapi.yml", "-port=8080"] diff --git a/examples/docker/openapi3.yml b/examples/docker/openapi.yml similarity index 100% rename from examples/docker/openapi3.yml rename to examples/docker/openapi.yml