Execute Command Dialog lets you easily run common commands on open documents.
It can for instance be used to quickly change a readonly document to writable
by selecting a chmod +w command in the dialog or to check out a file from a
source code control system using the respective checkout command.
To bring up the Execute Command Dialog click the dirty/read-only icon in the
status bar. You may then select the desired command from the list in the dialog
and execute it by double clicking or hitting OK.
If the Use Worksheet checkbox
is selected the command will be executed in the worksheet shell by pasting
it into the worksheet.
Unless Append To End Of Worksheet is selected the command
will be pasted into the current selection.
If Paste Only is selected the command
will not be executed, you may for instance want to edit it first before executing
it yourself.
Executing commands in a worksheet has the advantage that the command
may rely on the current state of the worksheet environment, something that may be
important when for instance when executing source control commands. You may
also reuse the command later by selecting an executing it directly from the
worksheet. For simple commands it may be more convenient to have the command
executed directly. A good example is chmod +w <document name>
or chmod -w
<document name>
to toggle a read-only state of a document on and off. In this
case you do not need to rely on any environment variables and don't necessarily
want to polute your worksheet with the extra text. By turning off the Use Worksheet
checkbox the command will be executed in a temporary shell that quits immediately
after the command.
Currently Execute Command Dialog needs to be configured by adding commands in the UserStartup. The syntax is:
AddToExecuteDialog '<someCommand>' [-worksheet] [-appendToEnd] [-pasteOnly]The command string needs to be in quotes. You may use variables in the command string that gets replaced by say the name of the document you execute the command on or other values. The three different options correspond to the three checkboxes.
# a command to check out a file, needs to be issued in a worksheet because # it relies on the source code control environment being set up AddToExecuteDialog 'cho $DOCUMENT' -worksheet -appendToEnd
# a command to paste a open command into the worksheet; You will have to # execute it later yourself because of the -pasteOnly option AddToExecuteDialog 'File $DOCUMENT' -worksheet -appendToEnd -pasteOnly
# a commad to set a document to be read-only; executes directly without # pasting anything into the worksheet AddToExecuteDialog 'chmod -w $DOCUMENT'
The following variables are currently supported by the execute dialog syntax:
$DOCUMENT $DOCUMENT_DIR | get the document path and the document parent path |
$WORKSHEET $WORKSHEET_DIR | get the worksheet path and the worksheet parent path |
$TARGET $TARGET_DIR | get the target path and the target parent path; target is the document under the find dialog or under your shell window |
$SELECTED_TEXT | get the selected text in the current window |
$EDDIE $EDDIE_HOME | get the Eddie app path and the Eddie app parent path |