-
Notifications
You must be signed in to change notification settings - Fork 30
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
Simplify Command
boilerplate for typical use-cases
#218
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
totten
changed the title
Simplify
Simplify Sep 24, 2024
Command
pattern for typical use-casesCommand
boilerplate for typical use-cases
…BaseApplication::configure() This is a semantic change to how BaseApplication is initialized. However, I don't believe anyone else is using this yet, so it's academic.
totten
force-pushed
the
master-cmd-ref
branch
from
September 24, 2024 17:58
d01fa84
to
4cbdf55
Compare
It can be used in either inherited style or fluent style. And this symbol has not yet been published via cv-lib
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This is a general shuffling the
Command
class hierarchy. The basicCommand
fromsymfony/console
is the same, but several of the helpers used bycv
commands have been moved around.Most notably, the
BaseCommand
(internal tocv-app
) has been replaced by theCvCommand
(which is now part ofcv-lib
). The contract forCvCommand
should be easier to use, and -- when we get CiviCRM extension integration (#219) -- it should slot-in more easily.Before
The
BaseCommand
class is internal to cv-app. It is fairly heavy with helpers that don't need to be in there (low cohesion).Pretty much all commands require the use of
BootTrait
. The boilerplate code involves importing the trait, activating the trait, and then figuring out where to call a few helper functions. This is done in every command-class.After
The
CvCommand
class is part of cv-lib, and it includesBootTrait
.Some other helpers have been moved out to standalone utilities.
Common bootstrap options (
--level
,--user
) are declared inBaseApplication
. Bootstrap behavior is automatically included by way ofCvCommand
. The default behavior assumes that you want Civi to be booted before running the command. But this can be overridden viagetBootOptions()
.Comments
plugins.md
referred to this part of the functionality as experimental. Plugin support was only recently merged. So... I don't think there's much of an install-base needing the old contracts ofBootTrait
.--level
and--user
should still work, but they can't work the same. (TheCommand
class hasn't been loaded... so we have to start processing those flags before have theCommand
.)