-
Notifications
You must be signed in to change notification settings - Fork 38
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
Refactor internal/command by removing normalizers #576
Conversation
5dc20e0
to
470a3f3
Compare
96d9c0c
to
fba647d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM, just one typo in comments.
internal/command/command.go
Outdated
return res, args, nil | ||
} | ||
|
||
func (c *base) findProgramInKnownInterpretters(programName string, args []string) (string, []string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findProgramInKnownInterpretters
single t
in interpreters
One issue I'm noticing is that Relevant comment: #566 (comment) |
This should be addressed in d1d7e2f. |
a171dce
to
5882f7c
Compare
Quality Gate passedIssues Measures |
Remove the concept of normalizers from
internal/command
. Introduce hierarchical commands andcommand.Factory
, instead.This PR makes it more explicit how various command types are created.
Before there were really two types of commands, namely native and virtual. The latter was using pty under the hood. Whether a particular program was executed inline or through a script file was decided in normalizers that modified
command.ProgramConfig
(knowncommand.Config
earlier).With this change, each command type is a separate struct. The commands are hierarchical, i.e. there is a
command.base
and higher-level commands which embedcommand.internalCommand
.All commands creation is managed by
command.Factory
so a caller does not need to worry about which command type to create. The caller will typically write the code like this: