Skip to content

Commit

Permalink
feat: add clidoc task and program
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Aug 5, 2020
1 parent 00bfa09 commit e44d256
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ GO_DEPENDENCIES = github.com/ory/go-acc \

define make-go-dependency
# go install is responsible for not re-building when the code hasn't changed
.PHONY: .bin/$(notdir $1)
.bin/$(notdir $1):
.bin/$(notdir $1): go.sum go.mod
GOBIN=$(PWD)/.bin/ go install $1
endef

Expand All @@ -25,6 +24,12 @@ $(foreach dep, $(GO_DEPENDENCIES), $(eval $(call make-go-dependency, $(dep))))
node_modules: package.json
npm ci

.bin/clidoc:
go build -o .bin/clidoc ./cmd/clidoc/.

docs/cli: .bin/clidoc
clidoc .

# Runs full test suite including tests where databases are enabled
.PHONY: test-legacy-migrations
test-legacy-migrations: test-resetdb sqlbin
Expand Down
18 changes: 18 additions & 0 deletions cmd/clidoc/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
"fmt"
"os"

"github.com/ory/x/clidoc"

"github.com/ory/hydra/cmd"
)

func main() {
if err := clidoc.Generate(cmd.RootCmd, os.Args[1:]); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "%+v", err)
os.Exit(1)
}
fmt.Println("All files have been generated and updated.")
}

0 comments on commit e44d256

Please sign in to comment.