.TH "commandline" 1 "8 Feb 2007" "Version 1.22.3" "fish" \" -*- nroff -*- .ad l .nh .SH NAME commandline - set or get the current commandline buffer .PP .SS "Synopsis" \fCcommandline [OPTIONS] [CMD]\fP .SS "Description" .IP "\(bu" 2 \fCCMD\fP is the new value of the commandline. If unspecified, the current value of the commandline is written to standard output. .PP .PP The following switches change what the commandline builtin does .PP .IP "\(bu" 2 \fC-C\fP or \fC--cursor\fP set or get the current cursor position, not the contents of the buffer. If no argument is given, the current cursor position is printed, otherwise the argument is interpreted as the new cursor position. .IP "\(bu" 2 \fC-f\fP or \fC--function\fP inject readline functions into the reader. This option can not be combined with any other option. It will cause any additional arguments to be interpreted as readline functions, and these functions will be injected into the reader, so that they will be returned to the reader before any additional actual key presses are read. .PP .PP The following switches change the way \fCcommandline\fP updates the commandline buffer .PP .IP "\(bu" 2 \fC-a\fP or \fC--append\fP do not remove the current commandline, append the specified string at the end of it .IP "\(bu" 2 \fC-i\fP or \fC--insert\fP do not remove the current commandline, insert the specified string at the current cursor position .IP "\(bu" 2 \fC-r\fP or \fC--replace\fP remove the current commandline and replace it with the specified string (default) .PP .PP The following switches change what part of the commandline is printed or updated .PP .IP "\(bu" 2 \fC-b\fP or \fC--current-buffer\fP select the entire buffer (default) .IP "\(bu" 2 \fC-j\fP or \fC--current-job\fP select the current job .IP "\(bu" 2 \fC-p\fP or \fC--current-process\fP select the current process .IP "\(bu" 2 \fC-t\fP or \fC--current-token\fP select the current token. .PP .PP The following switch changes the way \fCcommandline\fP prints the current commandline buffer .PP .IP "\(bu" 2 \fC-c\fP or \fC--cut-at-cursor\fP only print selection up until the current cursor position .IP "\(bu" 2 \fC-o\fP or \fC--tokenize\fP tokenize the selection and print one string-type token per line .PP .PP If commandline is called during a call to complete a given string using \fCcomplete -C STRING\fP, commandline will consider the specified string to be the current contents of the commandline. .SS "Example" \fCcommandline -j $history[3]\fP .PP replaces the job under the cursor with the third item from the commandline history.