EivindArvesen / prm

A minimal project manager for the terminal.
BSD 3-Clause "New" or "Revised" License
443 stars 18 forks source link

prm stop fails in ZSH #1

Closed greyhoundforty closed 9 years ago

greyhoundforty commented 9 years ago

I am sure that is probably not supported but any chance you can point me to why project stop is failing to drop back to a normal shell

ryan@galileo ~/illustris- ❯❯❯ prm stop illustris                                                                                                                                         master On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.
Stopping project illustris
rm: remove regular file ‘/home/ryan/.prm/.active.d’? y
rm: remove regular file ‘/home/ryan/.prm/.path.d’? y
/home/ryan/prm/prm.sh:export:144: not valid in this context: "}%F{4}${_prompt_sorin_pwd}%(!.
zsh: parse error
${SSH_TTY:+"ryan@galileo                                                                                                                                                                      ⏎ _zsh_highlight_widget_reset-prompt: parse error
${SSH_TTY:+"ryan@galileo                                                                                                                                                                      ⏎ _zsh_highlight_widget_reset-prompt: parse error
${SSH_TTY:+"ryan@galileo
EivindArvesen commented 9 years ago

It seems to fail when trying to change the prompt back to what it was before starting prm.

Could you try replacing the contents on line 144 with export PS1="$(cat $prm_dir/.prompt.d)", i.e. placing the variable value in quotes?

BTW, have you had to any/much fiddling with the script to make it work with zsh?

EivindArvesen commented 9 years ago

@greyhoundforty: I have now updated the line in question, though there might be more issues (e.g. cd-ing from scripts might not work) because of the hashbang, if I understand correctly.

Please let me know whether the problem persists or not.

greyhoundforty commented 9 years ago

Looks like this is due to the way ZSH ( in my case Prezto) is interpreting the ()'s in the if statement:

Stopping project illustris
rm: remove regular file ‘/home/ryan/.prm/.active-2897.tmp’? n
rm: remove regular file ‘/home/ryan/.prm/.path-2897.tmp’? n
rm: remove regular file ‘/home/ryan/.prm/.prompt-2897.tmp’? n
/home/ryan/prm/prm.sh:204: parse error near `)'

It does not exit the shell though so that is good news. I am relatively new to ZSH so I am going to keep hacking on it. Love the utility

greyhoundforty commented 9 years ago

Getting there. Found the right syntax for the if statement in ZSH:

Stopping project vagrant
rm: remove regular file ‘/home/ryan/.prm/.active-13099.tmp’? y
rm: remove regular file ‘/home/ryan/.prm/.path-13099.tmp’? y
rm: remove regular file ‘/home/ryan/.prm/.prompt-13099.tmp’? y
/home/ryan/prm/prm.sh:200: no matches found: .active*

ryan@galileo ~/.prm ❯❯❯ awk NR==204 ~/prm/prm.sh
        if [[ ! $(ps -p $pid > /dev/null) ]]; then
EivindArvesen commented 9 years ago

Glad you like it!

I just pushed an update that should make prm compatible with zsh. Let me know how it works!

vindarel commented 9 years ago

Hi ! prm stops properly for me in zsh (ohmyzsh).

Congrats, it's really handy :)

EivindArvesen commented 9 years ago

@vindarel: Good to hear. Thank you, glad you find it useful!

@greyhoundforty: Are you still having issues, or does prm work properly now?

greyhoundforty commented 9 years ago

@eivind88 Looks to be working for me now. Might have had some legacy cruft left from the initial install:

ryan@athena ~ ❯❯❯ prm start illustris
Starting project illustris
Already up-to-date.

ryan@athena ~/illustris- ❯❯❯ prm stop illustris                                                                                                  master ✱
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   runcoms/zshrc

no changes added to commit (use "git add" and/or "git commit -a")
Stopping project illustris
EivindArvesen commented 9 years ago

Great! I'll close the issue, then.