I'm testing a new drush command to automate a few tasks. The file I created is customc.drush.inc. My question: where do I save this file?

I tried saving it to one of the following folders
/drush/customc.drush.inc
/drush/commands/customc.drush.inc

Then called drush customc but it gives me a command not found error.

Is there a step I'm missing?

Comments

greg.1.anderson’s picture

Status: Active » Fixed

$HOME/.drush/customc.drush.inc is a good place.

bunoti’s picture

Strange, it gives command not found.

I'm working on Windows and have drush installed in C|drush, outside the Drupal installation and outside localhost altogether. Any suggestions what could be the problem? I'd like to try this command if I can only get it to take.

bunoti’s picture

Status: Fixed » Active
greg.1.anderson’s picture

Status: Active » Postponed (maintainer needs more info)

Post your drush.inc file; maybe there is something wrong with it. [drush]/commands/customc.drush.inc isn't a great place to put your command files, but that should work.

bunoti’s picture

I doubt it's a problem with the command file itself. I experimented with Moshe's sandwich.drush.inc command and tried it at several locations and had the same behavior. When I try "drush sandwich", I get "The drush command 'sandwich' could not be found." Drush works fine, just not the custom commands.

greg.1.anderson’s picture

Take a look at the code in the function _drush_find_commandfiles() in command.inc. Try adding $options['SHARE_PREFIX'] = 'C:' to your drushrc.php, then put your custom commands in C:/share/drush/commands. If that doesn't work, change the / to \ in the code and see if it works. If Windows needs the \s in the path, let me know here and I'll fiddle with it.

vunger’s picture

Component: Code » PM (dl, en, up ...)
Status: Postponed (maintainer needs more info) » Active

Didn't work for me:

>drush make
$options['SHARE_PREFIX'] = 'C:'The drush command 'make' could not be found.
[error]

So I tried changing / to \. That didn't work either; the result was the same.

vunger’s picture

Oops, forgot the <?php at the top of my drushrc.php file. Fixed that, now I'm getting:

C:\xampp\htdocs\droopal>drush make
Drush command could not be completed. ←[31;40m←[1
m[error]←[0m

vunger’s picture

Component: PM (dl, en, up ...) » Miscellaneous
jonhattan’s picture

Component: Miscellaneous » PM (dl, en, up ...)

Using / or \ in windows doesn't matter. See: http://alanhogan.com/tips/php/directory-separator-not-necessary

btw, DIRECTORY_SEPARATOR is useful for path parsing (rtrim, explode,..) but not needed for path generation. Windows is powerful enough :p

@vunger: #8 seems a separate issue. Try --debug btw.

vunger’s picture

Thanks, but I give up using drush make in Windows.

moshe weitzman’s picture

Status: Active » Closed (cannot reproduce)
alex.skrypnyk’s picture

For future reference:
In case if your command is not picked up, delete 'cache' directory in '.drush', as drush caches commands list.