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

Not compatible with Zsh #117

Closed
Nerian opened this Issue Aug 25, 2011 · 36 comments

Comments

Projects
None yet
@Nerian

Nerian commented Aug 25, 2011

Hello,

The Rake task for creating a new post seems to be not compatible with Zsh.

rake new_post["Zombie Ninjas Attack: A survivor's retrospective"]   
zsh: no matches found: new_post[Zombie Ninjas Attack: A survivor's retrospective]
@zanshin

This comment has been minimized.

Show comment
Hide comment
@zanshin

zanshin Aug 25, 2011

Contributor

You need to create an alias for rake in your .zshrc. Like this:

alias rake="noglob rake"

With that in place you'll be good to go.

Contributor

zanshin commented Aug 25, 2011

You need to create an alias for rake in your .zshrc. Like this:

alias rake="noglob rake"

With that in place you'll be good to go.

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Aug 25, 2011

Owner

Thanks @zan5hin! I should add that to the setup docs!

Owner

imathis commented Aug 25, 2011

Thanks @zan5hin! I should add that to the setup docs!

@imathis imathis closed this Aug 25, 2011

@mysteriouspants

This comment has been minimized.

Show comment
Hide comment
@mysteriouspants

mysteriouspants Aug 25, 2011

Contributor

If you don't feel like not globbing, the following works fairly well, too:

  rake "new_post[Zombie Ninjas Attack: A Pastafarian's Retrospective]"

It probably dies on a lot of characters, but if you're in a bind, it's better than nothing.

Contributor

mysteriouspants commented Aug 25, 2011

If you don't feel like not globbing, the following works fairly well, too:

  rake "new_post[Zombie Ninjas Attack: A Pastafarian's Retrospective]"

It probably dies on a lot of characters, but if you're in a bind, it's better than nothing.

@Merovex

This comment has been minimized.

Show comment
Hide comment
@Merovex

Merovex Sep 10, 2011

Had the same problem, the .zshrc fix did not work, but @nserror comment worked.

Merovex commented Sep 10, 2011

Had the same problem, the .zshrc fix did not work, but @nserror comment worked.

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Sep 10, 2011

Owner

That's pretty awful. Perhaps I should ditch the inline variable and make it a dialog?

rake new_post
Enter a post title:
Owner

imathis commented Sep 10, 2011

That's pretty awful. Perhaps I should ditch the inline variable and make it a dialog?

rake new_post
Enter a post title:
@Nerian

This comment has been minimized.

Show comment
Hide comment
@Nerian

Nerian Sep 10, 2011

I like that idea

Nerian commented Sep 10, 2011

I like that idea

@LucasTizma

This comment has been minimized.

Show comment
Hide comment
@LucasTizma

LucasTizma Sep 18, 2011

I think a dialog prompt would be better as well. It seems to be unhappy with a bunch of the character combinations I've tried.

LucasTizma commented Sep 18, 2011

I think a dialog prompt would be better as well. It seems to be unhappy with a bunch of the character combinations I've tried.

@LucasTizma

This comment has been minimized.

Show comment
Hide comment
@LucasTizma

LucasTizma Sep 18, 2011

For example, post titles with commas in them generate files that are truncated after the comma, likely as a result of how the [] expression is parsed. Unless I'm just too stupid to figure out how to properly escape it...

LucasTizma commented Sep 18, 2011

For example, post titles with commas in them generate files that are truncated after the comma, likely as a result of how the [] expression is parsed. Unless I'm just too stupid to figure out how to properly escape it...

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Sep 18, 2011

Owner

I'm sorry for the annoyance, I didn't realize rake was so poor at arguments. This is on the list of coming attractions.

Owner

imathis commented Sep 18, 2011

I'm sorry for the annoyance, I didn't realize rake was so poor at arguments. This is on the list of coming attractions.

@zanshin

This comment has been minimized.

Show comment
Hide comment
@zanshin

zanshin Sep 19, 2011

Contributor

I'm not able to create a posting with a comma either. Using a \ to escape the comma didn't help. If you do add a prompt for the post name, could that be optional? I.e., if I enter rake new_post["Some title"] have it work as it does not, but if I just enter rake new_post have it prompt me for the title?

Contributor

zanshin commented Sep 19, 2011

I'm not able to create a posting with a comma either. Using a \ to escape the comma didn't help. If you do add a prompt for the post name, could that be optional? I.e., if I enter rake new_post["Some title"] have it work as it does not, but if I just enter rake new_post have it prompt me for the title?

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Sep 19, 2011

Owner

Yeah I don't want everyone to have to relearn how to post. If the args are empty it'll ask for a title. Good thought.

Owner

imathis commented Sep 19, 2011

Yeah I don't want everyone to have to relearn how to post. If the args are empty it'll ask for a title. Good thought.

@mysteriouspants

This comment has been minimized.

Show comment
Hide comment
@mysteriouspants

mysteriouspants Sep 19, 2011

Contributor

Calling downcase on the title when making the filename might be a good idea, too. ;-)

Contributor

mysteriouspants commented Sep 19, 2011

Calling downcase on the title when making the filename might be a good idea, too. ;-)

@mrcasals

This comment has been minimized.

Show comment
Hide comment
@mrcasals

mrcasals Sep 28, 2011

I'm having the same trouble, and if I write rake new_post it just creates a new post titled "New post" and doesn't ask for the title as @imathis suggested... Any idea on when will it be implemented? :)

mrcasals commented Sep 28, 2011

I'm having the same trouble, and if I write rake new_post it just creates a new post titled "New post" and doesn't ask for the title as @imathis suggested... Any idea on when will it be implemented? :)

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Sep 28, 2011

Owner

I'm currently working full steam on getting the 2.1 release ready. It's going to be in there. Sorry for the delay. I'm hoping to have it up this weekend.

Owner

imathis commented Sep 28, 2011

I'm currently working full steam on getting the 2.1 release ready. It's going to be in there. Sorry for the delay. I'm hoping to have it up this weekend.

@mrcasals

This comment has been minimized.

Show comment
Hide comment
@mrcasals

mrcasals Sep 28, 2011

Oh, nice to hear that! I'll wait, then :)

mrcasals commented Sep 28, 2011

Oh, nice to hear that! I'll wait, then :)

@fmeyer

This comment has been minimized.

Show comment
Hide comment
@fmeyer

fmeyer Dec 10, 2011

Still not working without the external quotes. 👎

btw tks @nserror

fmeyer commented Dec 10, 2011

Still not working without the external quotes. 👎

btw tks @nserror

@davidcelis

This comment has been minimized.

Show comment
Hide comment
@davidcelis

davidcelis Jan 29, 2012

Sooooo what's the news on this?

davidcelis commented Jan 29, 2012

Sooooo what's the news on this?

@Merovex

This comment has been minimized.

Show comment
Hide comment
@Merovex

Merovex Jan 29, 2012

Hmm... for my part I can say it all works for me with alias rake='noglob rake' I have the latest Octopress. The old dialog is still in place.

Merovex commented Jan 29, 2012

Hmm... for my part I can say it all works for me with alias rake='noglob rake' I have the latest Octopress. The old dialog is still in place.

@davidcelis

This comment has been minimized.

Show comment
Hide comment
@davidcelis

davidcelis Jan 29, 2012

The alias fixed it for me as well, but it would be nice for Cctopress to support zsh without us having to alias things in our shell. Just thought I'd give this issue a bump.

davidcelis commented Jan 29, 2012

The alias fixed it for me as well, but it would be nice for Cctopress to support zsh without us having to alias things in our shell. Just thought I'd give this issue a bump.

@Merovex

This comment has been minimized.

Show comment
Hide comment
@Merovex

Merovex Jan 29, 2012

http://www.faqs.org/faqs/unix-faq/shell/zsh/

http://www.scottw.com/zsh-rake-parameters

The problem isn't Octopress, per se. The problem is globbing. I just tried to google the size of the problem, and found it virtually non-existent. So, I started looking at zsh more closely and happened upon this:

http://zsh.sourceforge.net/Doc/Release/Expansion.html#Filename-Generation

If a word contains an unquoted instance of one of the characters ‘’, ‘(’, ‘|’, ‘<’, *‘[’**, or ‘?’, it is regarded as a pattern for filename generation, unless the GLOB option is unset.

The issue is Octopress' rake command "rake new_post['his is a new post?']" contains an unquoted instance of [

Perhaps Octopress should have a command like?

rake new_post="This is a new post?"

But no, if you look at http://rake.rubyforge.org/files/doc/rakefile_rdoc.html (Tasks with Options) you see...

Just a few words of caution. The rake task name and its arguments need to be a single command line argument to rake. This generally means no spaces. If spaces are needed, then the entire rake + argument string should be quoted. Something like this:

   rake "name[billy bob, smith]"

So, even if zsh weren't a problem, it appears the proper command in Rake syntax should be:

rake "new_post[This is a new post?]"

Not only would that be canonical, it should also get around the zsh glob issue as the left square brace would be in quotes.

We are a victim of Rake's syntax, not Octopresses, I'm afraid. But, I like my non-globbed overlord.

Merovex commented Jan 29, 2012

http://www.faqs.org/faqs/unix-faq/shell/zsh/

http://www.scottw.com/zsh-rake-parameters

The problem isn't Octopress, per se. The problem is globbing. I just tried to google the size of the problem, and found it virtually non-existent. So, I started looking at zsh more closely and happened upon this:

http://zsh.sourceforge.net/Doc/Release/Expansion.html#Filename-Generation

If a word contains an unquoted instance of one of the characters ‘’, ‘(’, ‘|’, ‘<’, *‘[’**, or ‘?’, it is regarded as a pattern for filename generation, unless the GLOB option is unset.

The issue is Octopress' rake command "rake new_post['his is a new post?']" contains an unquoted instance of [

Perhaps Octopress should have a command like?

rake new_post="This is a new post?"

But no, if you look at http://rake.rubyforge.org/files/doc/rakefile_rdoc.html (Tasks with Options) you see...

Just a few words of caution. The rake task name and its arguments need to be a single command line argument to rake. This generally means no spaces. If spaces are needed, then the entire rake + argument string should be quoted. Something like this:

   rake "name[billy bob, smith]"

So, even if zsh weren't a problem, it appears the proper command in Rake syntax should be:

rake "new_post[This is a new post?]"

Not only would that be canonical, it should also get around the zsh glob issue as the left square brace would be in quotes.

We are a victim of Rake's syntax, not Octopresses, I'm afraid. But, I like my non-globbed overlord.

@jmacdonald

This comment has been minimized.

Show comment
Hide comment
@jmacdonald

jmacdonald Mar 1, 2012

I like the idea of a dialog/prompt for this; the resulting syntax is much more Rake-like and is much easier to remember.

jmacdonald commented Mar 1, 2012

I like the idea of a dialog/prompt for this; the resulting syntax is much more Rake-like and is much easier to remember.

@vodafon

This comment has been minimized.

Show comment
Hide comment
@vodafon

vodafon Mar 27, 2012

rake new_post\["This is New Post"\] 

good work for me

vodafon commented Mar 27, 2012

rake new_post\["This is New Post"\] 

good work for me

@jtratner

This comment has been minimized.

Show comment
Hide comment
@jtratner

jtratner May 16, 2012

I wrote a function to side-step this issue (and just do new-post "title"). https://gist.github.com/2708914 Handles the globbing issue too.

This tops the results on Google for "octopress and zsh" (and it's where I figured out how to resolve my problem), so I figured I'd leave this here for the benefit of future searchers. For everybody else, sorry about the notification spam!

jtratner commented May 16, 2012

I wrote a function to side-step this issue (and just do new-post "title"). https://gist.github.com/2708914 Handles the globbing issue too.

This tops the results on Google for "octopress and zsh" (and it's where I figured out how to resolve my problem), so I figured I'd leave this here for the benefit of future searchers. For everybody else, sorry about the notification spam!

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis May 21, 2012

Owner

I've just added bfa5255 which asks for a post title from stein if you run new_post without a value.

Owner

imathis commented May 21, 2012

I've just added bfa5255 which asks for a post title from stein if you run new_post without a value.

vrdabomb5717 pushed a commit to vrdabomb5717/octopress that referenced this issue May 21, 2012

Rake new post now accepts:
- Inline input as in `rake new_post["Your post title"]
- Input from stdin if in-line input isn't given.

This should help zhs users who've been frustrated by globbing issues.
Fixes #117
@createbang

This comment has been minimized.

Show comment
Hide comment
@createbang

createbang Jul 29, 2012

Definitely appreciate the .zshrc alias comment. Fixed the issue for me, too.

createbang commented Jul 29, 2012

Definitely appreciate the .zshrc alias comment. Fixed the issue for me, too.

@westonplatter

This comment has been minimized.

Show comment
Hide comment
@westonplatter

westonplatter Aug 7, 2012

@imathis per your bfa5255 commit, I tried, rake new_post and was not prompted for a title, but rather the title was automatically "new post" and the file was <date>-new-post.markdown.

Did you change this?

westonplatter commented Aug 7, 2012

@imathis per your bfa5255 commit, I tried, rake new_post and was not prompted for a title, but rather the title was automatically "new post" and the file was <date>-new-post.markdown.

Did you change this?

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Aug 18, 2012

Owner

@westonplatter Rake new_post has had defaults for a long time.

Owner

imathis commented Aug 18, 2012

@westonplatter Rake new_post has had defaults for a long time.

@atmosx

This comment has been minimized.

Show comment
Hide comment
@atmosx

atmosx Sep 11, 2012

Latest version, used here with oh-my-zsh, some issues still persist:

➜  .octopress git:(master) ✗ rake new_post[\"test"\]
dquote>
➜  .octopress git:(master) ✗ rake "new_post[test]"
mkdir -p source/_posts
Creating new post: source/_posts/2012-09-11-test.markdown
➜  .octopress git:(master) ✗ rm source/_posts/2012-09-11-* 
➜  .octopress git:(master) ✗ rake "new_post[karida loaded!]"
zsh: event not found: ]
➜  .octopress git:(master) ✗ rake "new_post[karida loaded]"
mkdir -p source/_posts
Creating new post: source/_posts/2012-09-11-karida-loaded.markdown
➜  .octopress git:(master) ✗ 

I can't put special chars like: $!@#%^&.. in the title. But it's okay...

atmosx commented Sep 11, 2012

Latest version, used here with oh-my-zsh, some issues still persist:

➜  .octopress git:(master) ✗ rake new_post[\"test"\]
dquote>
➜  .octopress git:(master) ✗ rake "new_post[test]"
mkdir -p source/_posts
Creating new post: source/_posts/2012-09-11-test.markdown
➜  .octopress git:(master) ✗ rm source/_posts/2012-09-11-* 
➜  .octopress git:(master) ✗ rake "new_post[karida loaded!]"
zsh: event not found: ]
➜  .octopress git:(master) ✗ rake "new_post[karida loaded]"
mkdir -p source/_posts
Creating new post: source/_posts/2012-09-11-karida-loaded.markdown
➜  .octopress git:(master) ✗ 

I can't put special chars like: $!@#%^&.. in the title. But it's okay...

@zanshin

This comment has been minimized.

Show comment
Hide comment
@zanshin

zanshin Sep 11, 2012

Contributor

Try creating an alias like this alias rake="noglob rake".

Contributor

zanshin commented Sep 11, 2012

Try creating an alias like this alias rake="noglob rake".

@atmosx

This comment has been minimized.

Show comment
Hide comment
@atmosx

atmosx Sep 11, 2012

Already did that.

atmosx commented Sep 11, 2012

Already did that.

@kud

This comment has been minimized.

Show comment
Hide comment
@kud

kud Sep 29, 2012

+1 for zsh support.

kud commented Sep 29, 2012

+1 for zsh support.

@chrishough

This comment has been minimized.

Show comment
Hide comment
@chrishough

chrishough Dec 30, 2012

the alias rake="noglob rake" worked for me with iterm2 (zsh)

chrishough commented Dec 30, 2012

the alias rake="noglob rake" worked for me with iterm2 (zsh)

@freme

This comment has been minimized.

Show comment
Hide comment
@freme

freme Oct 18, 2013

bundle exec rake "new_post[no special characters]"
was what i needed to run with rake 0.9.6 (using a oh-my-zsh and iterm2)

freme commented Oct 18, 2013

bundle exec rake "new_post[no special characters]"
was what i needed to run with rake 0.9.6 (using a oh-my-zsh and iterm2)

@ridwanahmedkhan

This comment has been minimized.

Show comment
Hide comment
@ridwanahmedkhan

ridwanahmedkhan Aug 22, 2014

Had the same problem, the .zshrc fix did not work, but @nserror comment worked.thanks.

ridwanahmedkhan commented Aug 22, 2014

Had the same problem, the .zshrc fix did not work, but @nserror comment worked.thanks.

@strivingboy

This comment has been minimized.

Show comment
Hide comment
@strivingboy

strivingboy Jun 17, 2015

thanks good work for me

strivingboy commented Jun 17, 2015

thanks good work for me

@liuyix

This comment has been minimized.

Show comment
Hide comment
@liuyix

liuyix Oct 20, 2015

I have the same problem, but using the alias rake="noglob rake" works fine. Putting this suggestion in the doc may be helpful for many folks :-)

liuyix commented Oct 20, 2015

I have the same problem, but using the alias rake="noglob rake" works fine. Putting this suggestion in the doc may be helpful for many folks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment