[TxMt] Re: Session ID?

Allan Odgaard mailinglist at textmate.org
Sun Nov 16 16:46:07 UTC 2014


On 16 Nov 2014, at 16:55, John DeSoi wrote:

> It was so long ago, I don't remember exactly why. I assume it was to 
> setup PATH and take advantage of require_cmd. If I write my own 
> require_cmd in PHP, is there a right way to set this up without 
> requiring the PHP interpreter at /usr/bin/php?

TextMate 2 has a better system for declaring requirements.

You’ll have to manually edit the XML of the tmCommand as it’s 
currently not exposed in the bundle editor. If you insert the XML below 
in your tmCommand then TextMate will find `psql` by checking if the 
value of `TM_PSQL` is valid, searching `PATH`, and finally trying the 
locations listed in the `locations` array.

If it finds `psql` then it sets `TM_PSQL` to where it is located and 
runs the command. So your command should use the `TM_PSQL` variable 
(rather than rely on finding it via `PATH`).

If `psql` is not found, TextMate shows a dialog explaining the issue 
(and does not run your command).

If you leave out the variable from the XML below, TextMate will instead 
update `PATH` if `psql` is not already in the `PATH` (e.g. if found via 
`locations`) — but we recommend keeping the variable, as it’s more 
flexible (for the user).

	<key>requiredCommands</key>
	<array>
		<dict>
			<key>command</key>
			<string>psql</string>
			<key>variable</key>
			<string>TM_PSQL</string>
			<key>locations</key>
			<array>
				<string>/usr/local/bin/psql</string>
				<string>/opt/local/bin/psql</string>
			</array>
			<key>moreInfoURL</key>
			<string>http://www.postgresql.org/docs/9.2/static/app-psql.html</string>
		</dict>
	</array>


More information about the textmate mailing list