Skip to content

Commit d2975f5

Browse files
authored
chore(project-structure): Align CLI files with cobra-cli -L (#25)
Signed-off-by: Manuel Dewald <manuel@codesphere.com>
1 parent 8c9f891 commit d2975f5

File tree

14 files changed

+24
-7
lines changed

14 files changed

+24
-7
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,23 @@ If you encounter a bug or have a feature request, please [open a new issue](http
1717

1818
We'd love to hear your ideas! Please [open a new issue](https://github.com/codesphere-cloud/cs-go/issues/new) to discuss your proposed feature or improvement before submitting code. This allows us to align on the design and approach.
1919

20+
## How to Add a New Subcommand to the CLI
21+
22+
This project currently uses a fork of cobra-cli with locally-scoped variables: https://github.com/NautiluX/cobra-cli-local.
23+
24+
Please use it to add new commands to the Go CLI like following:
25+
26+
```
27+
cobra-cli add -L -d cli -p list teams
28+
```
29+
30+
Run the generated `AddListTeamsCmd()` function in the parent `cli/cmd/list.go` to add the subcommand.
31+
This will add the following command to the CLI:
32+
33+
```
34+
cs list teams
35+
```
36+
2037
## Contributing Code
2138

2239
If you'd like to contribute code, please follow these steps:

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ generate: install-build-deps
1717
go generate ./...
1818

1919
build:
20-
cd cmd/cs && go build
21-
mv cmd/cs/cs .
20+
go build -C cli -o ../cs
2221

23-
install:
24-
cd cmd/cs && go install
22+
GOBIN ?= $(shell go env GOPATH)/bin
23+
install: build
24+
mv cs ${GOBIN}/
2525

2626
generate-client:
2727
ifeq (, $(shell which openapi-generator-cli))
File renamed without changes.
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package cmd_test
55

66
import (
77
"github.com/codesphere-cloud/cs-go/api"
8-
"github.com/codesphere-cloud/cs-go/cmd"
8+
"github.com/codesphere-cloud/cs-go/cli/cmd"
99

1010
. "github.com/onsi/ginkgo/v2"
1111
. "github.com/onsi/gomega"
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)