EivindArvesen/prm

Feature request: Customize the opening of start and stop scripts

NVolcz opened this issue · 7 comments

When using prm with cygwin on Windows, native editors can't handle the unix path.
Example:

$ bash -x ~/bin/prm/prm.sh add test1
+ sublime_text.exe /home/myusername/.prm/test1/start.sh
+ sublime_text.exe /home/myusername.prm/test1/stop.sh

Some way to customize the path is therefor wanted, and should provide the possibility to execute the following line:

sublimetext `cygpath.exe -d "/home/myusername/.prm/test1/start.sh"`

The line in question:
https://github.com/eivind88/prm/blob/master/prm.sh#L164

Unfortunately, I currently have no way to test prm on WIndows (with Cygwin), but I think this can be fixed pretty quickly.

What does the command
uname -s
output under Cygwin?

Something matching CYGWIN_*?

I think I've fixed your issue.
See the commit referencing this issue, and the feature branch.
Let me know how it works!

@NVolcz : I've pushed a fix based on your comment.

I'm getting other errors now. I was using efb759b before and now I'm getting the following error:

$ prm add
prm MUST be sourced - not run in a subshell.
i.e. '. ./prm'

Debug output:

$ bash -x ./prm.sh add
+ COPY='Written by Eivind Arvesen, 2015.'
+ VERSION=0.5.0
++ printf 'prm MUST be sourced - not run in a subshell.\ni.e. '\''. ./prm'\''\n'
++ echo ' '
+ SOURCE='prm MUST be sourced - not run in a subshell.
i.e. '\''. ./prm'\''
 '
++ basename ./prm.sh
+ '[' prm.sh = prm.sh ']'
++ printf %s 'prm MUST be sourced - not run in a subshell.
i.e. '\''. ./prm'\''
 '
+ return_error 1 'prm MUST be sourced - not run in a subshell.
i.e. '\''. ./prm'\''
 '
+ '[' 'prm MUST be sourced - not run in a subshell.
i.e. '\''. ./prm'\''
 ' ']'
+ echo 'prm MUST be sourced - not run in a subshell.
i.e. '\''. ./prm'\''
 '
prm MUST be sourced - not run in a subshell.
i.e. '. ./prm'

+ '[' 1 ']'
+ return 1
+ exit

@NVolcz : Are you using the feature branch?

And is "prm" in your case a reference to an alias, where the script is sourced (as alluded to in the error message)?

The debug output you cited will always be the same, as long as prm is run with bash (in a subshell), as opposed to with . or source (sourced). For more information, see the readme.

P.S. If you don't already know, the prm "add" option takes at least one argument (project name).

It works now! My alias was not correctly configured, pardon for not RTFM :-).
The fix also works fine with both vim and sublime text as editors.

Great to hear!