EivindArvesen / prm

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

Feature request: Customize the opening of start and stop scripts #27

Closed NVolcz closed 8 years ago

NVolcz commented 8 years ago

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

EivindArvesen commented 8 years ago

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_*?

EivindArvesen commented 8 years ago

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

EivindArvesen commented 8 years ago

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

NVolcz commented 8 years ago

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
EivindArvesen commented 8 years ago

@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).

NVolcz commented 8 years ago

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.

EivindArvesen commented 8 years ago

Great to hear!