Home Download Buy Blog Forum Support

Persistent Command Window

Persistent Command Window

Postby n00ge on Sun Apr 03, 2011 11:42 pm

I'm interested in writing some utility scripts for SASS to do a few simple things. Is there a way to run a command in the command line and make the window persistent? Essentially I'd like to run something along these lines:
'sass --watch $file_path:$file_path'

The reason I want to do this is because sass leaves a session open watching the directory for changes which needs to be closed through the command line. If there's a better way to do this, I'm open for ideas.
http://twitter.com/n00ge
Sublime Text 3 dev builds | OS X 10.8.2 & Ubuntu 13.04
n00ge
 
Posts: 140
Joined: Mon Oct 05, 2009 1:23 am

Re: Persistent Command Window

Postby jps on Mon Apr 04, 2011 4:46 am

Could you explain a bit more what you mean by a persistent window?
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Persistent Command Window

Postby n00ge on Mon Apr 04, 2011 11:22 am

Generally the command window is suppressed when running commands (cmd.exe) within sublime. Is there a way to run a command, open the cmd window, and keep the window open?
http://twitter.com/n00ge
Sublime Text 3 dev builds | OS X 10.8.2 & Ubuntu 13.04
n00ge
 
Posts: 140
Joined: Mon Oct 05, 2009 1:23 am

Re: Persistent Command Window

Postby atomi on Mon Apr 04, 2011 5:15 pm

I'd like to know how to do this too.

Taking it further, as a feature request, I'd like to be able to send commands to that open window arbitrarily as well.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: Persistent Command Window

Postby jps on Tue Apr 05, 2011 12:39 pm

It's not something I'm planning on adding (it's very much a win32 only thing: on linux and osx sub processes are just spawned as is, without any equivalent of cmd.exe being involved), but you could make a build system that runs "cmd.exe /c start my_real_command.bat", and you'd get a stand alone window.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Persistent Command Window

Postby n00ge on Tue Apr 05, 2011 1:15 pm

I'll play around with that and see where I get. Thanks Jon.
http://twitter.com/n00ge
Sublime Text 3 dev builds | OS X 10.8.2 & Ubuntu 13.04
n00ge
 
Posts: 140
Joined: Mon Oct 05, 2009 1:23 am

Re: Persistent Command Window

Postby quesada on Tue Apr 05, 2011 2:11 pm

+1.
would love to be able to send commands to that open window too. On linux. basically spawn a shell that listens to subl. Then select text, press a shortcut, and have it appear in the shell. This would be killer for ERPL. Easy to do in emacs and vim, even gedit. I think it'd be easy in subl too?
quesada
 
Posts: 31
Joined: Mon Mar 07, 2011 1:32 am

Re: Persistent Command Window

Postby n00ge on Thu Apr 07, 2011 9:09 pm

I'd like to have the .bat file reside in the package directory. I've setup a sasswatch.bat in the root of my SASS package. It contains:
Code: Select all
{
    "cmd": ["sasswatch.bat", "$file_path"],
    "selector": "source.sass"
}


My sasswatch.bat contains
Code: Select all
sass --watch %1:%1


I'm getting an error that it isn't finding sasswatch.bat. How do I change the active directory to be the package's directory so I can call that file?
http://twitter.com/n00ge
Sublime Text 3 dev builds | OS X 10.8.2 & Ubuntu 13.04
n00ge
 
Posts: 140
Joined: Mon Oct 05, 2009 1:23 am

Re: Persistent Command Window

Postby jps on Thu Apr 07, 2011 9:55 pm

You should be able to add:

Code: Select all
"working_dir": "$packages/Sass"
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Persistent Command Window

Postby n00ge on Fri Apr 08, 2011 12:44 am

That works Jon. Thanks for the info.
http://twitter.com/n00ge
Sublime Text 3 dev builds | OS X 10.8.2 & Ubuntu 13.04
n00ge
 
Posts: 140
Joined: Mon Oct 05, 2009 1:23 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 9 guests