-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
cli: sopel-module #1434
cli: sopel-module #1434
Conversation
I'm really enjoying watching you have fun building this new interface, but I'm curious about one point: How does this work with multiple config files? (Or rather, how do you plan to make it do so?) |
I'll add the same options used by I may want to change the messages, too: after using enable/disable, operator needs to restart the sopel instance using this configuration file, so a warning line could be welcome. Oh well, we'll see. This PR is open for comments! |
Ok, since I'm quite happy with the current state of this PR, I added the -c option:
I added the option for each sub-command, otherwise you have to do Even if I think there are room for improvement (the This experiment, so far, show that:
I would say it's expected for such old software with a lot of built-in modules, with a low focus on third-party modules and tools. Nothing impossible to fix, and many little things are possible to be done for the 7.0 release! |
03fade8
to
776cbb4
Compare
dcdeb0d
to
24268b4
Compare
@dgw I updated my description, and removed obsolete comments in the PR. I think it's safe to have a look now. It's ready to be merged, and I'd love to work on the next step. That is to say: moving So yeah, it was fun to work on that but now I can't do much more without refactoring too many code. :p |
a9e320f
to
aa4490f
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.
So far, there's one user-facing thing (sopel-module list
shows __init__.py
) that would be best fixed in a separate rewrite of the module-finding API that this CLI calls. We discussed this already on IRC.
I'm playing with it first, then I'll look at the code for any obvious things.
Edit: As mentioned on IRC, there's a case to be made for rewriting some of the module logic before coming back to this. Things like packaged modules with several files seem to throw this CLI off, and it's probably shortcomings in the underlying internal functions doing that.
Let's work on that first then! I'll close this PR for now. |
Disclaimer: this is an experimental command line tool. I suggest to merge it as-is, and to iterate in further PR if we need to. I've been working on that for few days, and I think now it is in a good enough shape to work properly.
So last day I was working on #1424 and #1429 and I was wondering: how can I get the list of available/enabled modules for Sopel? So I look up the CLI (
sopel
orpython sopel.py
) with no result.So... maybe I could do something about that? After all, there is an old issue about module enabled/excluded (#244), and maybe I can suggest a solution.
And here it is: a Pull Request that adds a new command line interface:
sopel-module
.Entry point
At the moment, I added a
sopel-module
entry point in thesetup.py
configuration.Maybe later we'll need to add a
.py
file at the root of this repository, like there is to launchpython sopel.py
from the source.That'll be for later.
Code organization
I don't like having a
sopel.run_script
module. I think, if we want to add multiple CLI for sopel, we should have a proper sub-package for that.So I put all my code into
sopel.cli
, and the function used as entry point ismain
.I think this structure could be use for the
run_script
code too, but I don't want to change that in that PR: it'll be for another one, once this is merged.CLI
To test it from the source:
This will install both entry point
sopel
andsopel-module
in your virtualenv, and then you can do:Good luck with the review!
list
The command
sopel-module list
enumerate modules, as Sopel does when looking for modules.show
The
sopel-module show <module>
command display various information about the module (if found): it tries to list commands, rules pattern, events and intents, that will be loaded by the module.enable
The
sopel-module enable <module>
tries to enable a module:If there is no whitelist yet, this command won't use it. Maybe an option could be added later for that - I suggest to keep it simple for now, and to iterate in further PRs.
disable
The
sopel-module disable <module>
tries to disable a module by adding it to the list of excluded.