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

[poc] do not merge! #374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[poc] do not merge! #374

wants to merge 1 commit into from

Conversation

denismakogon
Copy link
Member

the idea is to get rid of cli.Context wherever that is possible in order to get a reusable importable code.

the problem is that most of the function relies on cli.Context, this context is used for CLI flags only, so instead of passing a context down, we may retrieve necessary flag values to then pass them instead.

2nd thing is CLI command structs like:

type initFnCmd struct {
	force       bool
	triggerType string
	wd          string
	ff          *common.FuncFile
	ffV20180707 *common.FuncFileV20180707
}

most of the methods implemented on this struct are using func file, nothing else, so, in order to make code reusable we need to do two things (true way and an alternative):

  • extract core logic of those methods and make it reusable
  • make those methods structure-independent (i.e., if a method needs a reference to any of structure attributes - pass them as parameters, but not through a struct pointer reference).

I'm talking about specific method like:

func bindRoute(ff *common.FuncFile, fn *models.Route)

func bindFn(ff *common.FuncFileV20180707, fn *modelsV2.Fn)

etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant