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

Adjust the cli directory structure to facilitate third-party development #189

Closed
yixy opened this issue Sep 11, 2019 · 1 comment · Fixed by #190
Closed

Adjust the cli directory structure to facilitate third-party development #189

yixy opened this issue Sep 11, 2019 · 1 comment · Fixed by #190
Labels
chaosblade-cli chaosblade project type/enhancement New feature or request
Milestone

Comments

@yixy
Copy link
Contributor

yixy commented Sep 11, 2019

Issue Description

Type: feature request

Describe what happened (or what feature you want)

The code of chaosblade/cli is the command-line package, not the library package. Therefore, when a third party uses chaosblade to develop it into their own project, it may need to invade the code in the cli directory to modify it, which is not convenient for smooth migration after the subsequent chaosblade upgrade.

Describe what you expected to happen

Based on the above, Could we adjust the cli directory structure as follows, simplify the main.go content by moving other code into the cmd library package, and facilitate the integration of chaosblade into other projects.

▾ chaosblade/
    ▾ cli/
        ▾ cmd/
            cli.go
            commands.go
            ......
        main.go

main.go file:

package main

import (
	"fmt"
	"os"

	"github.com/chaosblade-io/chaosblade/cli/cmd"
)

func main() {
	baseCommand := cmd.CmdInit()
	if err := baseCommand.CobraCmd().Execute(); err != nil {
		_, _ = fmt.Fprintf(os.Stderr, "%s\n", err.Error())
		os.Exit(1)
	}
}

Please help confirm if this is appropriate, thank you!

@xcaspar
Copy link
Member

xcaspar commented Sep 11, 2019

@yixy Good suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chaosblade-cli chaosblade project type/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants