-
Notifications
You must be signed in to change notification settings - Fork 824
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
NEW Refactor CLI interaction with Silverstripe app #11353
NEW Refactor CLI interaction with Silverstripe app #11353
Conversation
db57250
to
942a93f
Compare
942a93f
to
dd5e39b
Compare
dd5e39b
to
dff8ca3
Compare
225a8f9
to
d3cb726
Compare
d56edb4
to
9a08b2e
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.
Change Hybrid*
to Poly*
Reason being that Hybird
means AND whereas Poly
is OR - e.g. polymorphic
78b06c0
to
c95d6dc
Compare
b4c359e
to
7cb613d
Compare
// These lines commented out from the parent class implementation. | ||
// We don't want this opinionated default colouring - it doesn't appear in the ANSI format so it doesn't belong in the output. | ||
// if ($this->inlineStyles) { | ||
// $html = sprintf('<span style="background-color: %s; color: %s">%s</span>', $this->inlineColors['black'], $this->inlineColors['white'], $html); | ||
// } else { | ||
// $html = sprintf('<span class="ansi_color_bg_black ansi_color_fg_white">%s</span>', $html); | ||
// } | ||
// We do need an opening and closing span though, or the HTML markup is broken |
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.
Makes sense to keep in I think to understand why this exists
4b1e49d
to
88a1f03
Compare
src/Cli/LegacyParamArgvInput.php
Outdated
|
||
public function __construct(?array $argv = null, ?InputDefinition $definition = null) | ||
{ | ||
Deprecation::withNoReplacement( |
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.
Should rebase it in then so we don't have things break later
src/Cli/LegacyParamArgvInput.php
Outdated
$tokens = ArrayLib::insertBefore($tokens, $convertedFlags, '--', true, true); | ||
} | ||
if ($hadLegacyParams) { | ||
// We only want the warning once regardless of how many params there are. |
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.
It's an E_USER_DEPRECATED
? Which is neither. Since we say 'notice' everywhere we should just refer to it as a notice rather than a warning.
- Turn sake into a symfony/console app - Avoid using HTTPRequest for CLI interaction - Implement abstract hybrid execution path
88a1f03
to
bb27aec
Compare
The idea is that you can define any combination of these in a module or project:
dev/*
route) e.g./dev/graphql/ide
which simply doesn't work in a CLI contextDirector::is_cli()
/dev/*
especiallyBuildTask
subclasses will use thisNew sake uses
tasks:mytask
format in CLI (this is standard for symfony console apps and means we can take advantage of grouping functionality), but the olddev/tasks/mytask
syntax will still work for at least the lifetime of CMS 6 so people don't have to immediately rewrite all their scripts. Thedev/
aliases are deprecated to be removed in the future.Flags can also still be passed as arguments (e.g.
--flush
can still be passed asflush=1
) but this is deprecated.The HTTP
/dev/*
routes (e.g./dev/build
) will still work exactly the same way they used to, from a user perspective. The only difference is where the code lives, how it's registered, and how theDevelopmentAdmin
class calls it - and the fact that additional help info including available parameters are shown in the list views.I'm pretty sure this is a low-traffic area in terms of customisation but the upgrade path is very straight forward in any case.
Existing
BuildTask
implementations whichecho
out their output directly should still work effectively as-is (i.e. just update the method and property signatures but don't update the method body) if people don't want to update to use the newPolyOutput
.The main thing that will change is that you won't have an
HTTPRequest
anymore - instead get vars and CLI flags will be given via symfony'sInputInterface
. Should be a very straight forward upgrade.I've implemented a
navigate
command (e.g.sake navigate about-us
) in case people have weird edge cases where they do explicitly want to use the old HTTPRequest-over-CLI style. But its use will be discouraged in favour of implementing aPolyCommand
.Issue