From 6139df926b75b0bdbe35d49feed3e3f1c52b51ea Mon Sep 17 00:00:00 2001 From: axel Date: Fri, 21 Oct 2005 22:39:45 +1000 Subject: [PATCH] Documentation and completion updates darcs-hash:20051021123945-ac50b-3d3b5004fdf8424190cae84c7b27b2088c87c080.gz --- doc_src/function.txt | 6 +++++- doc_src/psub.txt | 21 +++++++++++++++++++++ init/completions/function.fish | 5 ++++- init/completions/la.fish | 2 ++ init/completions/ll.fish | 2 ++ init/completions/ulimit.fish | 13 +++++++++++++ init/fish_function.fish | 19 ++++++++++++++----- 7 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 doc_src/psub.txt create mode 100644 init/completions/la.fish create mode 100644 init/completions/ll.fish create mode 100644 init/completions/ulimit.fish diff --git a/doc_src/function.txt b/doc_src/function.txt index 085072efc..6e55e0d9d 100644 --- a/doc_src/function.txt +++ b/doc_src/function.txt @@ -5,8 +5,12 @@ \subsection function-description Description -- -d DESCRIPTION or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description - \c -b or \c --key-binding specifies that the function is a key biding. Key binding functions work exactly like regular functions except that they can not be tab-completed, and may contain the '-' character. +- -d DESCRIPTION or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description +- -j PID or --on-job-exit PID tells fish to run this function when the job with group id PID exits +- -p PID or --on-process-exit PID tells fish to run this function when the fish child process with process id PID exits +- -s or --on-signal SIGSPEC tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a singal number, or the signal name, such as SIGHUP (or just HUP) +- -v or --on-variable VARIABLE_NAME tells fish to run this function when the variable VARIABLE_NAME changes value This builtin command is used to create a new function. A Function is a list of commands that will be executed when the name of the function diff --git a/doc_src/psub.txt b/doc_src/psub.txt new file mode 100644 index 000000000..d69c16fb6 --- /dev/null +++ b/doc_src/psub.txt @@ -0,0 +1,21 @@ + +\section psub psub - Perform process substitution + +\subsection psub-synopsis Synopsis + COMMAND1 (COMMAND2|psub) + +\subsection psub-description Description + +Posix shells feature a syntax that is a mix between command +substitution and piping, called process substitution. It is used to +send the output of a command into the calling command, much like +command substitution, but with the difference that the output is not +sent through commandline arguments but through a named pipe, with the +filename of the named pipe sent as an argument to the calling +program. The psub shellscript function, which when combined with a +regular command substitution provides the same functionality. + +\subsection psub-example Example + +diff (sort a.txt|psub) (sort b.txt|psub) shows the difference +between the sorted versions of files a.txt and b.txt. diff --git a/init/completions/function.fish b/init/completions/function.fish index c8baba314..7fcaa2ab9 100644 --- a/init/completions/function.fish +++ b/init/completions/function.fish @@ -1,4 +1,7 @@ complete -c function -s d -l description -d "Set function description" -x complete -c function -xa "(functions -n)" -d "Function" complete -c function -xa "(builtin -n)" -d "Builtin" - +complete -c function -s j -l on-job-exit -d "Make the function a job exit event handler" -x +complete -c function -s p -l on-process-exit -d "Make the function a process exit event handler" -x +complete -c function -s s -l on-signal -d "Make the function a signal event handler" -x +complete -c function -s v -l on-variable -d "Make the function a variable update event handler" -x diff --git a/init/completions/la.fish b/init/completions/la.fish new file mode 100644 index 000000000..3868e53e1 --- /dev/null +++ b/init/completions/la.fish @@ -0,0 +1,2 @@ + +complete -y ls diff --git a/init/completions/ll.fish b/init/completions/ll.fish new file mode 100644 index 000000000..3868e53e1 --- /dev/null +++ b/init/completions/ll.fish @@ -0,0 +1,2 @@ + +complete -y ls diff --git a/init/completions/ulimit.fish b/init/completions/ulimit.fish new file mode 100644 index 000000000..2b0405663 --- /dev/null +++ b/init/completions/ulimit.fish @@ -0,0 +1,13 @@ + +complete -c ulimit -s a -l all -d "Set or get all current limits" +complete -c ulimit -s c -l core-size -d "Maximum size of core files created" +complete -c ulimit -s d -l data-size -d "Maximum size of a process’s data segment" +complete -c ulimit -s f -l file-size -d "Maximum size of files created by the shell" +complete -c ulimit -s l -l lock-size -d "Maximum size that may be locked into memory" +complete -c ulimit -s m -l resident-set-size -d "Maximum resident set size" +complete -c ulimit -s n -l file-descriptor-count -d "Maximum number of open file descriptors" +complete -c ulimit -s s -l stack-size -d "Maximum stack size" +complete -c ulimit -s t -l cpu-time -d "Maximum amount of cpu time in seconds" +complete -c ulimit -s u -l process-count -d "Maximum number of processes available to a single user" +complete -c ulimit -s v -l virtual-memory-size -d "Maximum amount of virtual memory available to the shell" +complete -c ulimit -s h -l help -d "Display help and exit" diff --git a/init/fish_function.fish b/init/fish_function.fish index afa48a67c..55e8bf8db 100644 --- a/init/fish_function.fish +++ b/init/fish_function.fish @@ -921,8 +921,22 @@ function umask -d "Set default file permission mask" end + function psub -d "Read from stdin into a file and output the filename. Remove the file when the command that calles psub exits." + if count $argv >/dev/null + switch $argv[1] + case '-h*' --h --he --hel --help + + help psub + return 0 + + case '*' + echo psub: Unknown argument $argv[1] + return 1 + end + end + if not status --is-command-substitution echo psub: Not inside of command substitution return @@ -958,9 +972,6 @@ function psub -d "Read from stdin into a file and output the filename. Remove th end - -if status --is-interactive - function prevd-or-backward-word --key-binding if test -z (commandline) prevd @@ -991,5 +1002,3 @@ function delete-or-exit --key-binding exit end end - -end