-
Notifications
You must be signed in to change notification settings - Fork 94
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
lib/plugin: support plugin pinning #119
Conversation
Some alternatives to
|
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.
I have no issues with quoting. Using '*' is cool to me.
Watch out for API breaking changes. Either we should be backward compatible or start tagging/versioning. My concern is with existing custom plugins that might break with a geometry update. |
One thing I saw zplug do, which I like, is to release a version that prints out deprecation messages, then wait a month, then remove support. We can do that here, though we might be able to get away with just ignoring |
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.
Overall looks pretty good to me. Just some notes on the reads and a note on updating the node plugin.
Thanks for taking the time to add checks to the current plugins!
README.md
Outdated
@@ -75,6 +76,12 @@ These plugins will load and display on the right prompt. You can check the | |||
documentation and configuration for each specific plugin in the | |||
[plugins](/plugins) directory. | |||
|
|||
You can pin* a plugin by appending `*` to the end of the name. Geometry will always render the plugin. |
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.
I would add a note here on pinning, since when reading this document from the start you don't really get what it is. If I was a new user, I would think "wait, so plugins don't always render? Why not?"
What do you think of just prepending something like "Some plugins only render when you are in a given directory or in the presence of a given file. You can have them always render by pinning the plugin. (...)"?
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.
Good idea, prepended a sentence about pinning
plugins/README.md
Outdated
@@ -23,15 +23,15 @@ configuration files. | |||
|
|||
|
|||
```sh | |||
GEOMETRY_PROMPT_PLUGINS=(virtualenv docker_machine exec_time git hg) | |||
GEOMETRY_PROMPT_PLUGINS=(virtualenv docker_machine exec_time git hg 'rustup*') | |||
``` | |||
|
|||
*Note: if you're not sure where to put geometry configs, just add them to your `.zshrc`* |
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.
For the same reasons as before, if I missed the pinning section, I would be confused with the 'rustup*'
. Maybe add a link saying "if you're not sure what's with the *
you can read about it here" ? What's your take?
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.
Added a note beneath the current note
# Do nothing if we're not in a repository | ||
[ -d $PWD/.git ] || return 1 | ||
} | ||
``` |
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.
👍 nice example, clear explanation
plugins/rustup/README.md
Outdated
```sh | ||
GEOMETRY_PROMPT_PLUGINS+=('rustup*') | ||
``` | ||
|
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.
Note about pinning here? Since it is not required the plugin with the *
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.
removed the pinning
plugins/node/plugin.zsh
Outdated
GEOMETRY_NPM_VERSION="$(npm --version 2> /dev/null)" | ||
echo "$GEOMETRY_NODE_NPM_VERSION $GEOMETRY_NODE_VERSION ($GEOMETRY_NPM_VERSION)" | ||
fi | ||
GEOMETRY_NODE_VERSION="$(node -v 2> /dev/null)" |
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.
Just a note: don't forget to update this with the code recently merged from #108
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.
Rebased against master, will force push to this PR soon
I'm good with 'plugin*', don't have any strong feelings on that. None of the other suggestions do it better IMO. I moved the version discussion to #121 since a lot has been said in different PRs and issues. Might as well have a dedicated issue for that 😄 |
This adds geometry_prompt_plugin_check(), which will be run to determine if we are in a context where it makes sense to display the plugin A plugin can be pinned by appending a * to skip this check How can we could remove the quoting requirement for pins? GEOMETRY_PROMPT_PLUGINS+=(rustup*) instead of GEOMETRY_PROMPT_PLUGINS+=('rustup*')
I really don't like the extra ritual for globbing, this patch proposes |
I also made it backwards compatible in that, if you don't have a check function for a plugin, it just runs render. That way we don't need to version yet. |
b7d380e
to
1c79397
Compare
Looking great! @desyncr any takes? |
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.
Two small things. Should be good to go 👍
README.md
Outdated
@@ -75,6 +76,13 @@ These plugins will load and display on the right prompt. You can check the | |||
documentation and configuration for each specific plugin in the | |||
[plugins](/plugins) directory. | |||
|
|||
Some plugins only render when you are in a given directory or in the presence of a given file. | |||
You can have those plugins always render by pinning a `+` before the name |
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.
"before the name" => "before the name:"
plugins/README.md
Outdated
``` | ||
|
||
*Note: if you're not sure where to put geometry configs, just add them to your `.zshrc`* | ||
|
||
*Note: the `+` before rustup means the plugin is pinned, and will always render, regardless of context* |
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.
"pinned" should like to the "Pinning" section.
So, should I squash the three commits, rewrite the commit message, and push? Not sure what's good protocol. |
Precisely that. Squash, merge, push. Or just change the big green button on GitHub to say "Squash and merge" and hit that. |
This adds geometry_prompt_plugin_check(), which will be run to determine if we are in a context where it makes sense to display the plugin
A plugin can be pinned by appending a * to skip this check.
How can we could remove the quoting requirement for pins?
instead of