cot command

CotEditor has 'cot' command-line tool which allows you to control CotEditor from the command-line. To use cot command, install it at first.

Installation

You can install the cot command-line tool to a desired location creating a symbolic link via Terminal. The cot substance is bundled at 'Contents/SharedSupport/bin/cot' in CotEditor.app (We recommend to create it at '/usr/local/bin/').

ln -s /Applications/CotEditor.app/Contents/SharedSupport/bin/cot /usr/local/bin/cot

And uninstallation via Terminal is like the following:

unlink /usr/local/bin/cot

Options

The following options can be used on cot command.

-w, --waitWait for opened file to be closed before returning to a prompt.
-n, --newCreate a new blank document.
-l, --line <line>Jump to specific line in opened document. <line> is an integer specifying the number of line.
-c, --column <column>Jump to specific column in opened document. <column> is an integer specifying the number of column.
-b, --backgroundDo not bring the application to the foreground.
-h, --helpShow help.
-v, --versionPrint version information.

Examples

A simple cot command will launch CotEditor, or just activate it if CotEditor is already running.

cot

The following command opens the foo.txt file on CotEditor and scroll to the line 200 in the opened document. cot command do nothing if foo.txt file is not exists.

cot --line 200 foo.txt

You can also pipe a text. CotEditor will open a new document with the piped text.

echo "I am a dog but also a cow at the same time." | cot

See also