romkatv / zsh-defer

Deferred execution of Zsh commands
GNU General Public License v3.0
343 stars 11 forks source link

Incorrect output in FAQ #7

Closed ahmubashshir closed 2 years ago

ahmubashshir commented 2 years ago

Output in this section is incorrect. Correct one:

$ function say-hi() {
>  if (( $+zsh_defer_options )); then
>    echo "Hello from zsh-defer with options: $zsh_defer_options" >>/tmp/log
>  else
>    echo "Hello from without zsh-defer" >>/tmp/log
>  fi
>}
$ say-hi
$ tail -n1 /tmp/log
Hello from without zsh-defer
$ zsh-defer say-hi
$ tail -n1 /tmp/log
Hello from zsh-defer with options: 12dmszpr
romkatv commented 2 years ago

Send a PR? It'll let me see the difference and allow me to click a button to merge a fix.

ahmubashshir commented 2 years ago

Can I git send-email the patch? Mubashshir

On Wed, Oct 27 2021 at 09:38:19 AM -0700, Roman Perepelitsa @.***> wrote:

Send a PR? It'll let me see the difference and click a button to merge a fix.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/romkatv/zsh-defer/issues/7#issuecomment-953106425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5WM3SAVYMAAUVUAQY6GHTUJA2IXANCNFSM5G2ZLWAA.

romkatv commented 2 years ago

Sure, go ahead.

romkatv commented 2 years ago

Thanks for the patch. Applied. Here it is for the record:

From: Mubashshir <ahmubashshir@gmail.com>
To: roman.perepelitsa@gmail.com
Subject: [PATCH] Update FAQs section code snippet
Date: Wed, 27 Oct 2021 22:45:59 +0600
Message-Id: <20211027164559.437230-1-ahmubashshir@gmail.com>
X-Mailer: git-send-email 2.33.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

This commit sets the comment of that code snippet in correct order
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index fdbba2a..d743e94 100644
--- a/README.md
+++ b/README.md
@@ -156,8 +156,8 @@ function say-hi() {
   fi
 }

-say-hi            # Hello from zsh-defer with options: 12dmshp
-zsh-defer say-hi  # Hello from without zsh-defer
+say-hi            # Hello from without zsh-defer
+zsh-defer say-hi  # Hello from zsh-defer with options: 12dmshp
 ```

 ### Is zsh-defer a plugin manager?
-- 
2.33.1

Note that you can send patches directly to github threads (the same way you sent https://github.com/romkatv/zsh-defer/issues/7#issuecomment-953107354). Use my personal email when reporting vulnerabilities, in which case you might want to gpg encrypt the body, too. It's not a big deal though. I appreciate the fix.

romkatv commented 2 years ago

By the way, I don't recommend using zsh-defer because I don't know of any valid use cases of it. See https://github.com/romkatv/zsh-bench#deferred-initialization.

ahmubashshir commented 2 years ago

I use it to defer all fancy stuffs in zsh :3 Mubashshir

On Wed, Oct 27 2021 at 09:57:07 AM -0700, Roman Perepelitsa @.***> wrote:

By the way, I don't recommend using zsh-defer because I don't know of any valid use cases of it. See https://github.com/romkatv/zsh-bench#deferred-initialization.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/romkatv/zsh-defer/issues/7#issuecomment-953120742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5WM3V7QPSOFW4P7T5NPYTUJAVOHANCNFSM5G2ZLWAA.

ahmubashshir commented 2 years ago

I'm preparing a zsh-bench config of my $ZDOTDIR to test. Mubashshir

On Wed, Oct 27 2021 at 11:47:56 PM +0600, Mubashshir @.***> wrote:

I use it to defer all fancy stuffs in zsh :3 Mubashshir

On Wed, Oct 27 2021 at 09:57:07 AM -0700, Roman Perepelitsa @.***> wrote:

By the way, I don't recommend using zsh-defer because I don't know of any valid use cases of it. See https://github.com/romkatv/zsh-bench#deferred-initialization.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/romkatv/zsh-defer/issues/7#issuecomment-953120742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5WM3V7QPSOFW4P7T5NPYTUJAVOHANCNFSM5G2ZLWAA.

romkatv commented 2 years ago

I use it to defer all fancy stuffs in zsh :3 Mubashshir

Ouch. Ever case I've seen where anyone used zsh-defer was a mistake. Every. Single. One. I literally know of zero uses of zsh-defer where you don't have a better way of solving the same problem. At the same time I believe that zsh-defer is the best tool for deferral initialization out there.

ahmubashshir commented 2 years ago

BTW, I got to know zsh-defer from someone while I was lurking in irc://libera.chat/#zsh Mubashshir

On Wed, Oct 27 2021 at 11:48:37 PM +0600, Mubashshir @.***> wrote:

I'm preparing a zsh-bench config of my $ZDOTDIR to test. Mubashshir

On Wed, Oct 27 2021 at 11:47:56 PM +0600, Mubashshir @.***> wrote:

I use it to defer all fancy stuffs in zsh :3 Mubashshir

On Wed, Oct 27 2021 at 09:57:07 AM -0700, Roman Perepelitsa @.***> wrote:

By the way, I don't recommend using zsh-defer because I don't know of any valid use cases of it. See https://github.com/romkatv/zsh-bench#deferred-initialization.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/romkatv/zsh-defer/issues/7#issuecomment-953120742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5WM3V7QPSOFW4P7T5NPYTUJAVOHANCNFSM5G2ZLWAA.

ahmubashshir commented 2 years ago

Here's my dotfiles repo if you're curious: https://github.com/ahmubashshir/dotfiles Mubashshir

On Wed, Oct 27 2021 at 11:54:27 PM +0600, Mubashshir @.***> wrote:

BTW, I got to know zsh-defer from someone while I was lurking in irc://libera.chat/#zsh Mubashshir

On Wed, Oct 27 2021 at 11:48:37 PM +0600, Mubashshir @.***> wrote:

I'm preparing a zsh-bench config of my $ZDOTDIR to test. Mubashshir

On Wed, Oct 27 2021 at 11:47:56 PM +0600, Mubashshir @.***> wrote:

I use it to defer all fancy stuffs in zsh :3 Mubashshir

On Wed, Oct 27 2021 at 09:57:07 AM -0700, Roman Perepelitsa @.***> wrote:

By the way, I don't recommend using zsh-defer because I don't know of any valid use cases of it. See https://github.com/romkatv/zsh-bench#deferred-initialization.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/romkatv/zsh-defer/issues/7#issuecomment-953120742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5WM3V7QPSOFW4P7T5NPYTUJAVOHANCNFSM5G2ZLWAA.

romkatv commented 2 years ago

It's decent code and cool idea. It just has terrible trade offs. If you are into this sort of zsh geekery, read the whole zsh-bench doc.

ahmubashshir commented 2 years ago

Yeah, reading rn. Mubashshir

On Wed, Oct 27 2021 at 10:56:40 AM -0700, Roman Perepelitsa @.***> wrote:

It's decent code and cool idea. It just has terrible trade offs. If you are into this sort of zsh geekery, read the whole zsh-bench doc.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/romkatv/zsh-defer/issues/7#issuecomment-953174135, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF5WM3XYG3AV2GRHKL7CM73UJBDOPANCNFSM5G2ZLWAA.

romkatv commented 2 years ago

Here's my dotfiles repo if you're curious: https://github.com/ahmubashshir/dotfiles

Over 1k commits and god-knows-how-many files! Impressive 😁

If you have docker and a few minutes, take a test drive of this: https://github.com/romkatv/zsh4humans#try-it-in-docker