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

New CLI Plugin Type #2168

Merged
merged 6 commits into from Apr 5, 2018
Merged

New CLI Plugin Type #2168

merged 6 commits into from Apr 5, 2018

Conversation

splitbrain
Copy link
Collaborator

This PR introduces a new plugin type for command line tools. To do so, the DokuCLI class was deprecated and replaced by the library that grew out of it. The plugin base code was refactored into an interface and a trait to allow for injecting the plugin functionality into a different class hierarchy.

This also fixes #2152 by introducing log levels

It has few more features (like turning down verbosity) and looks nicer
This allows for using the functionality in class hierarchies that can
not inherit from DokuWiki_Plugin.
Now plugins can create their own command line interfaces. They are
executed through a single entry point in bin/plugin.php
@micgro42
Copy link
Collaborator

This does not implement the functionality of #2152, because there the output was shown/hidden depending on the output of the git-command itself. However, it makes sense to reimplement that pull request on top of this one.

I haven't had time to look at the code, but I noticed that even if the output is suppressed by the loglevel, either gittool or the new cli-plugin still prints a newline for each repository where the command was executed.

@micgro42
Copy link
Collaborator

micgro42 commented Dec 6, 2017

To be more precise about the empty lines: They are caused by the echo "\n"; in bin/gittool.php line 187.

This is should maybe be moved to the beginning and/or end of the $this->success, $this->error, $this->info function calls.

@@ -15,7 +15,6 @@
require_once(DOKU_INC.'inc/common.php');
require_once(DOKU_INC.'inc/confutils.php');
require_once(DOKU_INC.'inc/pluginutils.php');
require_once(DOKU_INC.'inc/plugin.php');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file can be added to the data/deleted.files file as well

Copy link
Collaborator

@Klap-in Klap-in left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks handy.
I have not much experience with these language structures. So if that needs more thought, others should ship in as well.

Copy link
Collaborator

@micgro42 micgro42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One typo, as mentioned. Otherwise looks good 👍 :shipit:

bin/plugin.php Outdated
define('NOSESSION', 1);
require_once(DOKU_INC . 'inc/init.php');

class pluginCLI extends CLI {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be PluginCLI (capital P)?

@splitbrain splitbrain merged commit 874fc8d into master Apr 5, 2018
@splitbrain splitbrain deleted the cli branch April 5, 2018 07:58
@micgro42 micgro42 mentioned this pull request Apr 5, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants