diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85004b8..c784009 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,6 +9,14 @@ The following should be to be installed on your device in order to contribute to ## Development +### Folder Structure +Charmil repository contains a number of components that can be consumed independently. In the root directory, the following folders can be found: + +- **cli** -command line tool for using charmil. +- **core** - charmil SDK +- **starter** - charmil starter template project +- **validator** - validator and linter library to test cobra commands + ### Running Charmil CLI Commands You can run the CLI commands files directly with go run. All commands and subcommands are in the ./pkg/cmd folder. ```bash @@ -32,4 +40,4 @@ Runs unit tests - You can join [Aerogear’s discord server](https://discord.gg/hsDJUPkAWH) to participate in the discussions happening ## License -By contributing, you agree that your contributions will be licensed under its Apache License 2.0 \ No newline at end of file +By contributing, you agree that your contributions will be licensed under its Apache License 2.0 diff --git a/Makefile b/Makefile index a9c6a15..9b8a830 100644 --- a/Makefile +++ b/Makefile @@ -7,22 +7,22 @@ help: @echo "" @echo "make lint run golangci-lint" @echo "make test run tests" - @echo "make format format files" + @echo "make format format files" @echo "make build build files" @echo "make setup/git/hooks setup git hooks" .PHONY: help run: - go run ./cmd/charmil + go run ./cli/cmd/charmil build: - go build ./cmd/charmil + go build ./cli/cmd/charmil install: - go install ./cmd/charmil + go install ./cli/cmd/charmil build/tags: - go build -tags ${TAGS} ./cmd/charmil + go build -tags ${TAGS} ./cli/cmd/charmil test: go test ./... @@ -30,14 +30,13 @@ test: # Requires golangci-lint to be installed @ $(go env GOPATH)/bin/golangci-lint # https://golangci-lint.run/usage/install/ lint: - golangci-lint run cmd/... pkg/... + golangci-lint run ./... .PHONY: lint # clean up code and dependencies format: @go mod tidy - @gofmt -w `find . -type f -name '*.go'` .PHONY: format diff --git a/cmd/charmil/locales/en/crud.en.yaml b/cli/cmd/charmil/locales/en/crud.en.yaml similarity index 100% rename from cmd/charmil/locales/en/crud.en.yaml rename to cli/cmd/charmil/locales/en/crud.en.yaml diff --git a/cmd/charmil/locales/en/init.en.yaml b/cli/cmd/charmil/locales/en/init.en.yaml similarity index 100% rename from cmd/charmil/locales/en/init.en.yaml rename to cli/cmd/charmil/locales/en/init.en.yaml diff --git a/cmd/charmil/locales/en/root.en.yaml b/cli/cmd/charmil/locales/en/root.en.yaml similarity index 100% rename from cmd/charmil/locales/en/root.en.yaml rename to cli/cmd/charmil/locales/en/root.en.yaml diff --git a/cmd/charmil/main.go b/cli/cmd/charmil/main.go similarity index 95% rename from cmd/charmil/main.go rename to cli/cmd/charmil/main.go index ef93bca..35be763 100644 --- a/cmd/charmil/main.go +++ b/cli/cmd/charmil/main.go @@ -6,15 +6,14 @@ import ( "log" "os" + "github.com/aerogear/charmil/cli/internal/cmd/crud" + "github.com/aerogear/charmil/cli/internal/cmd/root" c "github.com/aerogear/charmil/core/config" "github.com/aerogear/charmil/core/factory" "github.com/aerogear/charmil/core/localize" "github.com/spf13/cobra" "golang.org/x/text/language" - - "github.com/aerogear/charmil/pkg/cmd/crud" - "github.com/aerogear/charmil/pkg/cmd/root" ) // Defines the configuration keys of the host CLI. diff --git a/pkg/cmd/crud/crud.go b/cli/internal/cmd/crud/crud.go similarity index 98% rename from pkg/cmd/crud/crud.go rename to cli/internal/cmd/crud/crud.go index 6dfdab8..3f7e31a 100644 --- a/pkg/cmd/crud/crud.go +++ b/cli/internal/cmd/crud/crud.go @@ -7,8 +7,8 @@ import ( "os" "path/filepath" + "github.com/aerogear/charmil/cli/internal/template/crud" "github.com/aerogear/charmil/core/factory" - "github.com/aerogear/charmil/pkg/template/crud" "github.com/spf13/cobra" ) diff --git a/pkg/cmd/init/init.go b/cli/internal/cmd/init/init.go similarity index 100% rename from pkg/cmd/init/init.go rename to cli/internal/cmd/init/init.go diff --git a/pkg/cmd/root/root.go b/cli/internal/cmd/root/root.go similarity index 88% rename from pkg/cmd/root/root.go rename to cli/internal/cmd/root/root.go index 4ee712d..14e1955 100644 --- a/pkg/cmd/root/root.go +++ b/cli/internal/cmd/root/root.go @@ -1,8 +1,8 @@ package root import ( + initialize "github.com/aerogear/charmil/cli/internal/cmd/init" "github.com/aerogear/charmil/core/factory" - initialize "github.com/aerogear/charmil/pkg/cmd/init" "github.com/spf13/cobra" ) diff --git a/pkg/template/crud/create.go b/cli/internal/template/crud/create.go similarity index 100% rename from pkg/template/crud/create.go rename to cli/internal/template/crud/create.go diff --git a/pkg/template/crud/crud.en.yaml b/cli/internal/template/crud/crud.en.yaml similarity index 100% rename from pkg/template/crud/crud.en.yaml rename to cli/internal/template/crud/crud.en.yaml diff --git a/pkg/template/crud/delete.go b/cli/internal/template/crud/delete.go similarity index 100% rename from pkg/template/crud/delete.go rename to cli/internal/template/crud/delete.go diff --git a/pkg/template/crud/describe.go b/cli/internal/template/crud/describe.go similarity index 100% rename from pkg/template/crud/describe.go rename to cli/internal/template/crud/describe.go diff --git a/pkg/template/crud/list.go b/cli/internal/template/crud/list.go similarity index 100% rename from pkg/template/crud/list.go rename to cli/internal/template/crud/list.go diff --git a/pkg/template/crud/tmpl.go b/cli/internal/template/crud/tmpl.go similarity index 100% rename from pkg/template/crud/tmpl.go rename to cli/internal/template/crud/tmpl.go diff --git a/pkg/template/crud/use.go b/cli/internal/template/crud/use.go similarity index 100% rename from pkg/template/crud/use.go rename to cli/internal/template/crud/use.go