Skip to content

Commit

Permalink
Merge pull request #35 from strvcom/remove_commands
Browse files Browse the repository at this point in the history
Remove commands
  • Loading branch information
Fazt01 committed Aug 16, 2024
2 parents 08471da + 8433586 commit f47a1fb
Show file tree
Hide file tree
Showing 56 changed files with 27 additions and 5,279 deletions.
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

0 comments on commit f47a1fb

Please sign in to comment.