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

Add plugins support and a bunch of other enhancements #6

Merged
merged 15 commits into from
May 5, 2020

Conversation

dreadfullyposh
Copy link
Collaborator

So this is a fairly big update, and I could definitely use some review.

Plugins
I added support for cog plugins. Essentially this just means additional search paths for cog- commands.

cog now sources ~/.cogconfig if it exists and reads a comma-separated list of plugin paths from the COG_PLUGIN_DIRECTORIES= variable

The cog config command will create the .cogconfig file in the user's home directory if it does not exist.

Plugin Help
Hot on the tails of plugins is help for plugins.

The cog help command now searches the local bin directory, plugin directories, and the base cog path for a .cog-help script which outputs help information specific to that set of commands.

Other enhancements

  • Replaced the Python-dependent line for finding the real path to cog with a pure Bash replacement
  • Exported a set of colors, the cog path and the plugin directories into variables before executing cog commands, so you have access to those as needed
  • Updated the cog update command to change into the cog directory before sourcing the tools scripts, since that seemed like an error.

- source .cogconfig file for plugins
- replace python directory finding code with pure bash solution
- change cog script search functionality to search through an array of cog paths
- move path of cogconfig to home dir so it doesn’t get lost during updates
- add cog config command to create .cogconfig file
- consolidate exports in cog main file
- extend cog-help to search plugin directories
- clean up cog-config
@markhuot
Copy link
Contributor

One thing that might be nice to solve with this "search path" update is making it possible to execute cog from deeper directories. E.g., right now you have to run cog ssh in your project root, next to the ./bin/cog-ssh file.

This doesn't always work, though, because we'll sometimes shove Craft in to a deeper folder like web or app. In those cases you're typically running ./craft install or something a level deeper than your bin.

All this is to say: would it make sense to start at your current directory and go up the directory path until you find a .cogconfig or bin folder? Then you could run cog commands as well as plugin commands from your project config and/or from a deeper level.

This is similar to how git works.

With your changes I would think we could scan up the path and find the "project root" and push it in to that list of search paths?

@dreadfullyposh dreadfullyposh merged commit 6d827ba into master May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants