Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove commands #35

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ How to release a new version:
- Manually release new version.

## [Unreleased]
### Added
- Use `debug.ReadBuildInfo` to get correct version.
- Print to stderr on error.

### Removed
- `openapi compose`, `repo init`, `repo template` commands.

## [0.4.0] - 2023-03-27
### Added
Expand Down
50 changes: 0 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,56 +53,6 @@ type (
```
After triggering `go generate ./...` within an app, methods `MarshalText` and `UnmarshalText` along with other useful functions are generated.

### openapi
This command provides a set of tools to manage OpenAPI specifications.

Subcommand `compose` merges multiple OpenAPI specifications into a single schema. Example:
```shell
$ tea openapi compose -i ./api/openapi_compose.yaml -o ./api/openapi.yaml
```

This command can also be used as an embedded go generator to embed OpenAPI specification. Example:

```go
import _ "embed

//go:generate tea openapi compose -i ./openapi_compose.yaml -o ./openapi.yaml
//go:embed openapi.yaml
var OpenAPI string
```
After triggering `go generate ./...` within an app, `openapi.yaml` is generated. Afterthat, it is embedded into the app during build.

### repo
This command provides a set of tools to manage a local Go repository. Note that it is required to have a configured `.cup` file in the root of the repository
you wish to configure or have one in the home directory as a default.

Subcommand `template` finds and executes template files and folders in the repository. It is useful for creating a template repository
which will be later used for the creation of another project.
By default, it executes all files ending with `*.template` in the local directory and its subdirectories. Example:
```shell
$ tea repo template --recursive
```
.cup:
```yaml
repo:
template:
module: test
author: Jane Doe
values:
- name: config
data:
port: 8080
version: 0.1.0
```
test.template:
```yaml
module: {{ .Module }}
author: {{ .Author }}
config:
port: "{{ .Values.config.port }}"
version: {{ .Version }}
```

[release]: https://img.shields.io/github/v/release/strvcom/strv-backend-go-tea
[codecov]: https://codecov.io/gh/strvcom/strv-backend-go-tea
[codecov-img]: https://codecov.io/gh/strvcom/strv-backend-go-tea/branch/master/graph/badge.svg?token=A7QFX32CFF
Expand Down
11 changes: 2 additions & 9 deletions cmd/tea/gen_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"bytes"
"errors"
"fmt"
"go/ast"
"go/parser"
Expand Down Expand Up @@ -38,14 +37,8 @@ Example:
RefreshToken uint64
)
`,
Run: func(cmd *cobra.Command, args []string) {
if err := runGenerateIDs(genIDOptions.SourceFilePath, genIDOptions.OutputFilePath); err != nil {
e := &cmderrors.CommandError{}
if errors.As(err, &e) {
os.Exit(e.Code)
}
os.Exit(-1)
}
RunE: func(cmd *cobra.Command, args []string) error {
return runGenerateIDs(genIDOptions.SourceFilePath, genIDOptions.OutputFilePath)
},
}

Expand Down
12 changes: 10 additions & 2 deletions cmd/tea/main.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package main

import "os"
import (
"errors"
"os"

cmderrors "go.strv.io/tea/pkg/errors"
)

func main() {
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
if err := rootCmd.Execute(); err != nil {
// TODO: Log the error.
e := &cmderrors.CommandError{}
if errors.As(err, &e) {
os.Exit(e.Code)
}
os.Exit(1)
}
}
26 changes: 0 additions & 26 deletions cmd/tea/oapi.go

This file was deleted.

105 changes: 0 additions & 105 deletions cmd/tea/oapi_compose.go

This file was deleted.

75 changes: 0 additions & 75 deletions cmd/tea/oapi_compose_test.go

This file was deleted.

28 changes: 0 additions & 28 deletions cmd/tea/repo.go

This file was deleted.

Loading
Loading