Simplify styling

This commit is contained in:
Mark Griffiths 2014-08-01 13:25:41 +01:00
parent e22f0dda32
commit 1052eeee8c
70 changed files with 80 additions and 135 deletions

View file

@ -244,6 +244,7 @@ ALIASES += "blah{1}=\1"
ALIASES += "cmnd{1}=\1" ALIASES += "cmnd{1}=\1"
ALIASES += "func{1}=\1" ALIASES += "func{1}=\1"
ALIASES += "sbin{1}=\1" ALIASES += "sbin{1}=\1"
ALIASES += "args{1}=\1"
ALIASES += "opts{1}=\1" ALIASES += "opts{1}=\1"
ALIASES += "vars{1}=\1" ALIASES += "vars{1}=\1"
ALIASES += "optr{1}=\1" ALIASES += "optr{1}=\1"

View file

@ -244,6 +244,7 @@ ALIASES += "blah{1}=<span class=\"comment\">\1</span>"
ALIASES += "cmnd{1}=<span class=\"command\">\1</span>" ALIASES += "cmnd{1}=<span class=\"command\">\1</span>"
ALIASES += "func{1}=<span class=\"function\">\1</span>" ALIASES += "func{1}=<span class=\"function\">\1</span>"
ALIASES += "sbin{1}=<span class=\"binary\">\1</span>" ALIASES += "sbin{1}=<span class=\"binary\">\1</span>"
ALIASES += "args{1}=<span class=\"argument\">\1</span>"
ALIASES += "opts{1}=<span class=\"argument\">\1</span>" ALIASES += "opts{1}=<span class=\"argument\">\1</span>"
ALIASES += "vars{1}=<span class=\"variable\">\1</span>" ALIASES += "vars{1}=<span class=\"variable\">\1</span>"
ALIASES += "optr{1}=<span class=\"operator\">\1</span>" ALIASES += "optr{1}=<span class=\"operator\">\1</span>"

View file

@ -367,14 +367,7 @@ lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES
-e 'w lexicon_catalog.tmp' \ -e 'w lexicon_catalog.tmp' \
-e "s|'\(.*\)'|func \1|p"; \ -e "s|'\(.*\)'|func \1|p"; \
sed <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \ sed <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
-e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p' \ -e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \
-e '$$G;s/.*\n/==end==/p'; \
sed <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
-e '1G;s/.*\n/==styles==/p' \
-e '/set_default/s/.*fish_color\(_[a-z][a-z_]*\)/style\1/' \
-e '/^style_/s/_\([^ ]*\) --\([^ ]*\).*$$/ \1 \2/p' \
-e '/^style_/s/_\([^ ]* [^- ]*\) --\([^ ]*\).*$$/ \1 \2/p' \
-e '/^style_/s/_\([^ ]* [^- ]*\).*$$/ \1/p'; \
mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt; mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt;
# #
@ -395,11 +388,7 @@ doc_src/fish_lexicon_filter: lexicon.txt doc_src/fish_lexicon_filter.in
sed <$@.in >$@.tmp -e 's|@sed@|'"`command -v sed`"'|' -e '/^[ ]*#[^!]/d' sed <$@.in >$@.tmp -e 's|@sed@|'"`command -v sed`"'|' -e '/^[ ]*#[^!]/d'
# Scan through the lexicon, transforming each line to something usefue to Doxygen. # Scan through the lexicon, transforming each line to something usefue to Doxygen.
sed <lexicon.txt >>$@.tmp -n \ sed <lexicon.txt >>$@.tmp -n \
-e 's|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,[[:<:]]\2[[:>:]],@\1{\2},g|p' \ -e 's|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,[[:<:]]\2[[:>:]],@\1{\2},g|p';
-e '/==end==/G;s/.*\n/b tidy/p' \
-e '/==styles==/G;s/.*\n/:styles/p' \
-e 's|^\(style [^ ]*\) \(.*\)$$|s,\1,\2,|p' \
-e '$$G;s/.*\n/b processstyle/p'; \
mv $@.tmp $@; if test -x $@; then true; else chmod a+x $@; fi mv $@.tmp $@; if test -x $@; then true; else chmod a+x $@; fi
# #
@ -821,7 +810,7 @@ clean:
rm -f $(PROGRAMS) fish_tests key_reader rm -f $(PROGRAMS) fish_tests key_reader
rm -f command_list.txt command_list_toc.txt toc.txt rm -f command_list.txt command_list_toc.txt toc.txt
rm -f doc_src/index.hdr doc_src/commands.hdr rm -f doc_src/index.hdr doc_src/commands.hdr
rm -f doc_src/fish_lexicon_filter lexicon.txt doc_src/user_doc.css rm -f doc_src/fish_lexicon_filter lexicon.txt
rm -f FISH-BUILD-VERSION-FILE rm -f FISH-BUILD-VERSION-FILE
if test "$(HAVE_DOXYGEN)" = 1; then \ if test "$(HAVE_DOXYGEN)" = 1; then \
rm -rf doc user_doc share/man; \ rm -rf doc user_doc share/man; \

View file

@ -1,7 +1,7 @@
\section alias alias - create a function \section alias alias - create a function
\subsection alias-synopsis Synopsis \subsection alias-synopsis Synopsis
\fish{syn} \fish{synopsis}
alias NAME DEFINITION alias NAME DEFINITION
alias NAME=DEFINITION alias NAME=DEFINITION
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section and and - conditionally execute a command \section and and - conditionally execute a command
\subsection and-synopsis Synopsis \subsection and-synopsis Synopsis
\fish{syn} \fish{synopsis}
COMMAND1; and COMMAND2 COMMAND1; and COMMAND2
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section begin begin - start a new block of code \section begin begin - start a new block of code
\subsection begin-synopsis Synopsis \subsection begin-synopsis Synopsis
\fish{syn} \fish{synopsis}
begin; [COMMANDS...;] end begin; [COMMANDS...;] end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section bg bg - send jobs to background \section bg bg - send jobs to background
\subsection bg-synopsis Synopsis \subsection bg-synopsis Synopsis
\fish{syn} \fish{synopsis}
bg [PID...] bg [PID...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section bind bind - handle fish key bindings \section bind bind - handle fish key bindings
\subsection bind-synopsis Synopsis \subsection bind-synopsis Synopsis
\fish{syn} \fish{synopsis}
bind [OPTIONS] SEQUENCE COMMAND bind [OPTIONS] SEQUENCE COMMAND
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section block block - temporarily block delivery of events \section block block - temporarily block delivery of events
\subsection block-synopsis Synopsis \subsection block-synopsis Synopsis
\fish{syn} \fish{synopsis}
block [OPTIONS...] block [OPTIONS...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section break break - stop the current inner loop \section break break - stop the current inner loop
\subsection break-synopsis Synopsis \subsection break-synopsis Synopsis
\fish{syn} \fish{synopsis}
LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end LOOP_CONSTRUCT; [COMMANDS...] break; [COMMANDS...] end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section breakpoint breakpoint - Launch debug mode \section breakpoint breakpoint - Launch debug mode
\subsection breakpoint-synopsis Synopsis \subsection breakpoint-synopsis Synopsis
\fish{syn} \fish{synopsis}
breakpoint breakpoint
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section builtin builtin - run a builtin command \section builtin builtin - run a builtin command
\subsection builtin-synopsis Synopsis \subsection builtin-synopsis Synopsis
\fish{syn} \fish{synopsis}
builtin BUILTINNAME [OPTIONS...] builtin BUILTINNAME [OPTIONS...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section case case - conditionally execute a block of commands \section case case - conditionally execute a block of commands
\subsection case-synopsis Synopsis \subsection case-synopsis Synopsis
\fish{syn} \fish{synopsis}
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section cd cd - change directory \section cd cd - change directory
\subsection cd-synopsis Synopsis \subsection cd-synopsis Synopsis
\fish{syn} \fish{synopsis}
cd [DIRECTORY] cd [DIRECTORY]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section commandline commandline - set or get the current command line buffer \section commandline commandline - set or get the current command line buffer
\subsection commandline-synopsis Synopsis \subsection commandline-synopsis Synopsis
\fish{syn} \fish{synopsis}
commandline [OPTIONS] [CMD] commandline [OPTIONS] [CMD]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section contains contains - test if a word is present in a list \section contains contains - test if a word is present in a list
\subsection contains-synopsis Synopsis \subsection contains-synopsis Synopsis
\fish{syn} \fish{synopsis}
contains [OPTIONS] KEY [VALUES...] contains [OPTIONS] KEY [VALUES...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section continue continue - skip the remainder of the current iteration of the current inner loop \section continue continue - skip the remainder of the current iteration of the current inner loop
\subsection continue-synopsis Synopsis \subsection continue-synopsis Synopsis
\fish{syn} \fish{synopsis}
LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end LOOP_CONSTRUCT; [COMMANDS...;] continue; [COMMANDS...;] end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section count count - count the number of elements of an array \section count count - count the number of elements of an array
\subsection count-synopsis Synopsis \subsection count-synopsis Synopsis
\fish{syn} \fish{synopsis}
count $VARIABLE count $VARIABLE
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section dirh dirh - print directory history \section dirh dirh - print directory history
\subsection dirh-synopsis Synopsis \subsection dirh-synopsis Synopsis
\fish{syn} \fish{synopsis}
dirh dirh
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section dirs dirs - print directory stack \section dirs dirs - print directory stack
\subsection dirs-synopsis Synopsis \subsection dirs-synopsis Synopsis
\fish{syn} \fish{synopsis}
dirs dirs
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section echo echo - display a line of text \section echo echo - display a line of text
\subsection echo-synopsis Synopsis \subsection echo-synopsis Synopsis
\fish{syn} \fish{synopsis}
echo [STRING] echo [STRING]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section else else - execute command if a condition is not met \section else else - execute command if a condition is not met
\subsection else-synopsis Synopsis \subsection else-synopsis Synopsis
\fish{syn} \fish{synopsis}
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section emit emit - Emit a generic event \section emit emit - Emit a generic event
\subsection emit-synopsis Synopsis \subsection emit-synopsis Synopsis
\fish{syn} \fish{synopsis}
emit EVENT_NAME [ARGUMENTS...] emit EVENT_NAME [ARGUMENTS...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section end end - end a block of commands. \section end end - end a block of commands.
\subsection end-synopsis Synopsis \subsection end-synopsis Synopsis
\fish{syn} \fish{synopsis}
begin; [COMMANDS...] end begin; [COMMANDS...] end
if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end if CONDITION; COMMANDS_TRUE...; [else; COMMANDS_FALSE...;] end
while CONDITION; COMMANDS...; end while CONDITION; COMMANDS...; end

View file

@ -1,7 +1,7 @@
\section eval eval - evaluate the specified commands \section eval eval - evaluate the specified commands
\subsection eval-synopsis Synopsis \subsection eval-synopsis Synopsis
\fish{syn} \fish{synopsis}
eval [COMMANDS...] eval [COMMANDS...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section exec exec - execute command in current process \section exec exec - execute command in current process
\subsection exec-synopsis Synopsis \subsection exec-synopsis Synopsis
\fish{syn} \fish{synopsis}
exec COMMAND [OPTIONS...] exec COMMAND [OPTIONS...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section exit exit - exit the shell \section exit exit - exit the shell
\subsection exit-synopsis Synopsis \subsection exit-synopsis Synopsis
\fish{syn} \fish{synopsis}
exit [STATUS] exit [STATUS]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section fg fg - bring job to foreground \section fg fg - bring job to foreground
\subsection fg-synopsis Synopsis \subsection fg-synopsis Synopsis
\fish{syn} \fish{synopsis}
fg [PID] fg [PID]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section fish fish - the friendly interactive shell \section fish fish - the friendly interactive shell
\subsection fish-synopsis Synopsis \subsection fish-synopsis Synopsis
\fish{syn} \fish{synopsis}
fish [-h] [-v] [-c command] [FILE [ARGUMENTS...]] fish [-h] [-v] [-c command] [FILE [ARGUMENTS...]]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section fish_indent fish_indent - indenter and prettifier \section fish_indent fish_indent - indenter and prettifier
\subsection fish_indent-synopsis Synopsis \subsection fish_indent-synopsis Synopsis
\fish{syn} \fish{synopsis}
fish_indent [options] fish_indent [options]
\endfish \endfish

View file

@ -57,53 +57,10 @@
# End block # End block
/\\endfish/b /\\endfish/b
} }
/style/b styles
#. #.
# This is not the pattern we're looking for # This is not the pattern we're looking for
b b
#. #.
# Sets CSS styles according to fish defaults.
#.
# Used for building the documentation's CSS file
#.
:processstyle
#. Make Hex uniform
s/0x//g
/[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]*/ {
y/ABCDEF/abcdef/
s/^[0-9a-f]/#&/
}
#.
# Set simple styles
#.
s/bold/font-weight:bold;/
#.
# Replace named colours (taken from color.cpp)
#.
s/black/#000/
s/red/#f00/
s/green/#0f0/
s/brown/#725000/
s/yellow/#ff0/
s/blue/#00f/
s/magenta/#f0f/
s/purple/#f0f/
s/cyan/#0ff/
s/white/#fff/
s/normal/#fff text-decoration:none; border-bottom:none; font-weight:normal;/
#.
/background/ {
s/background=\(#[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*\)/background-color: \1;/
}
/underline/ {
s/^\(#[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*\).*$/\1 border-bottom: 2px solid \1;/
s/^underline$/text-decoration: underline;/
}
# If we start with just a colour, make it explicit.
s/^#[0-9a-f][0-9a-f]*/color: &;/
#.
# All done, return CSS style content
b
# Process any HTML tags. # Process any HTML tags.
# Structured to reduce sed's greediness. # Structured to reduce sed's greediness.
:html :html
@ -204,7 +161,7 @@ s/-\([A-Za-z]\)\([^A-Za-z}]\)/\\\
\2/g \2/g
#. #.
# Long options # Long options
s/--\([A-Za-z][A-Za-z0-9=_-]*\)\([^A-Za-z0-9]\)/\\\ s/--\([A-Za-z][A-Za-z0-9=_-]*\)\([^A-Za-z0-9=_-]*\)/\\\
<@opts{--\1}\ <@opts{--\1}\
\2/g \2/g
#. #.
@ -259,6 +216,9 @@ s/\n//g
s/\(fsfo{[^@]*\)@sbin{\([^}]*\)}/\1\2/ s/\(fsfo{[^@]*\)@sbin{\([^}]*\)}/\1\2/
t cleanfsfo t cleanfsfo
} }
# Convert 2nd order commands/functions and binaries to arguments
s/@cmnd/@args/g
s/@args/@cmnd/1
# Character Entities # Character Entities
#. #.
# Mark up a few sesitive characters. # Mark up a few sesitive characters.
@ -293,7 +253,7 @@ s/^[ ]*[^<][^@][^}]*$//
s/^[ ]*[^<][^@][^\\]*[\\ ()]*\n// s/^[ ]*[^<][^@][^\\]*[\\ ()]*\n//
:holdflush :holdflush
s/}[)(\\ ][)(\\ ]*/}/ s/}[)(\\ ][)(\\ ]*/}/
s/\n[];)|* ][^\\]*[\\]*// s/\n[];)|* -][^\\]*[\\]*//
t holdflush t holdflush
s/\n$// s/\n$//
#. #.
@ -321,7 +281,7 @@ s/\([A-Za-z*][A-Za-z]*\.[a-z0-9][a-z0-9]*\)/@fsfo{\1}/g
#. #.
# Manually add a few commands not harvested from source. # Manually add a few commands not harvested from source.
#. #.
s,[[:<:]]in[[:>:]],@cmnd{in},g s,[[:<:]]in[[:>:]],@args{in},g
s,[[:<:]]whoami[[:>:]],@sbin{whoami},g s,[[:<:]]whoami[[:>:]],@sbin{whoami},g
s,[[:<:]]fishd[[:>:]],@sbin{fishd},g s,[[:<:]]fishd[[:>:]],@sbin{fishd},g
#. #.
@ -360,8 +320,3 @@ s,[[:<:]]fishd[[:>:]],@sbin{fishd},g
# single line. # single line.
#. #.
# b tidy # b tidy
#.
# Colour lookup functions
#.
# The Makefile will add a table of colour names and values, possibly with
# extra style information, that are used to set defaults in the CSS file.

View file

@ -1,7 +1,7 @@
\section fish_prompt fish_prompt - define the appearance of the command line prompt \section fish_prompt fish_prompt - define the appearance of the command line prompt
\subsection fish_prompt-synopsis Synopsis \subsection fish_prompt-synopsis Synopsis
\fish{syn} \fish{synopsis}
function fish_prompt function fish_prompt
... ...
end end

View file

@ -1,7 +1,7 @@
\section fish_right_prompt fish_right_prompt - define the appearance of the right-side command line prompt \section fish_right_prompt fish_right_prompt - define the appearance of the right-side command line prompt
\subsection fish_right_prompt-synopsis Synopsis \subsection fish_right_prompt-synopsis Synopsis
\fish{syn} \fish{synopsis}
function fish_right_prompt function fish_right_prompt
... ...
end end

View file

@ -1,7 +1,7 @@
\section for for - perform a set of commands multiple times. \section for for - perform a set of commands multiple times.
\subsection for-synopsis Synopsis \subsection for-synopsis Synopsis
\fish{syn} \fish{synopsis}
for VARNAME in [VALUES...]; COMMANDS...; end for VARNAME in [VALUES...]; COMMANDS...; end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section funced funced - edit a function interactively \section funced funced - edit a function interactively
\subsection funced-synopsis Synopsis \subsection funced-synopsis Synopsis
\fish{syn} \fish{synopsis}
funced [OPTIONS] NAME funced [OPTIONS] NAME
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section funcsave funcsave - save the definition of a function to the user's autoload directory \section funcsave funcsave - save the definition of a function to the user's autoload directory
\subsection funcsave-synopsis Synopsis \subsection funcsave-synopsis Synopsis
\fish{syn} \fish{synopsis}
funcsave FUNCTION_NAME funcsave FUNCTION_NAME
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section function function - create a function \section function function - create a function
\subsection function-synopsis Synopsis \subsection function-synopsis Synopsis
\fish{syn} \fish{synopsis}
function [OPTIONS] NAME; BODY; end function [OPTIONS] NAME; BODY; end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section functions functions - print or erase functions \section functions functions - print or erase functions
\subsection functions-synopsis Synopsis \subsection functions-synopsis Synopsis
\fish{syn} \fish{synopsis}
functions [-a|--all] [-n|--names] functions [-a|--all] [-n|--names]
functions -c OLDNAME NEWNAME functions -c OLDNAME NEWNAME
functions -d DESCRIPTION FUNCTION functions -d DESCRIPTION FUNCTION

View file

@ -1,7 +1,7 @@
\section help help - display fish documentation \section help help - display fish documentation
\subsection help-synopsis Synopsis \subsection help-synopsis Synopsis
\fish{syn} \fish{synopsis}
help [SECTION] help [SECTION]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section if if - conditionally execute a command \section if if - conditionally execute a command
\subsection if-synopsis Synopsis \subsection if-synopsis Synopsis
\fish{syn} \fish{synopsis}
if CONDITION; COMMANDS_TRUE...; [else if CONDITION2; COMMANDS_TRUE2...;] [else; COMMANDS_FALSE...;] end if CONDITION; COMMANDS_TRUE...; [else if CONDITION2; COMMANDS_TRUE2...;] [else; COMMANDS_FALSE...;] end
\endfish \endfish

View file

@ -188,7 +188,7 @@ When you start a job in `fish`, `fish` itself will pause, and give control of th
Example: Example:
\fish \fish
emacs & emacs &amp;
\endfish \endfish
will start the emacs text editor in the background. will start the emacs text editor in the background.
@ -316,8 +316,7 @@ Specifying your own completions is not difficult. To specify a completion, use t
To provide a list of possible completions for myprog, use the `-a` switch. If `myprog` accepts the arguments start and stop, this can be specified as `complete -c myprog -a 'start stop'`. The argument to the `-a` switch is always a single string. At completion time, it will be tokenized on spaces and tabs, and variable expansion, command substitution and other forms of parameter expansion will take place. To provide a list of possible completions for myprog, use the `-a` switch. If `myprog` accepts the arguments start and stop, this can be specified as `complete -c myprog -a 'start stop'`. The argument to the `-a` switch is always a single string. At completion time, it will be tokenized on spaces and tabs, and variable expansion, command substitution and other forms of parameter expansion will take place.
Fish has a special syntax to support specifying switches accepted by a command. The switches `-s`, `-l` and `-o` are used to specify a short switch (single character, such as -l), a gnu style long switch (such as '`--color`') and an old-style long switch (like '`-shuffle`'), respectively. If the command 'myprog' has an option '-o' which can also be written as '`--output`', and which can take an additional value of either 'yes' or 'no', this can be specified by writing: `fish` has a special syntax to support specifying switches accepted by a command. The switches `-s`, `-l` and `-o` are used to specify a short switch (single character, such as `-l`), a gnu style long switch (such as '`--color`') and an old-style long switch (like '`-shuffle`'), respectively. If the command 'myprog' has an option '-o' which can also be written as '`--output`', and which can take an additional value of either 'yes' or 'no', this can be specified by writing:
\fish \fish
complete -c myprog -s o -l output -a "yes no" complete -c myprog -s o -l output -a "yes no"
@ -330,7 +329,7 @@ For examples of how to write your own complex completions, study the completions
\subsection completion-func Useful functions for writing completions \subsection completion-func Useful functions for writing completions
Fish ships with several functions that are very useful when writing command specific completions. Most of these functions name begins with the string '`__fish_`'. Such functions are internal to fish and their name and interface may change in future fish versions. Still, some of them may be very useful when writing completions. A few of these functions are described here. Be aware that they may be removed or changed in future versions of fish. `fish` ships with several functions that are very useful when writing command specific completions. Most of these functions name begins with the string '`__fish_`'. Such functions are internal to `fish` and their name and interface may change in future fish versions. Still, some of them may be very useful when writing completions. A few of these functions are described here. Be aware that they may be removed or changed in future versions of fish.
Functions beginning with the string `__fish_print_` print a newline- separated list of strings. For example, `__fish_print_filesystems` prints a list of all known file systems. Functions beginning with `__fish_complete_` print out a newline separated list of completions with descriptions. The description is separated from the completion by a tab character. Functions beginning with the string `__fish_print_` print a newline- separated list of strings. For example, `__fish_print_filesystems` prints a list of all known file systems. Functions beginning with `__fish_complete_` print out a newline separated list of completions with descriptions. The description is separated from the completion by a tab character.
@ -349,7 +348,7 @@ Functions beginning with the string `__fish_print_` print a newline- separated l
Completions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. Fish automatically searches through any directories in the array variable `$fish_complete_path`, and any completions defined are automatically loaded when needed. A completion file must have a filename consisting of the name of the command to complete and the suffix '`.fish`'. Completions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. Fish automatically searches through any directories in the array variable `$fish_complete_path`, and any completions defined are automatically loaded when needed. A completion file must have a filename consisting of the name of the command to complete and the suffix '`.fish`'.
The default value for `$fish`_complete_path is `~/.config/fish/completions` `/etc/fish/completions` `/usr/share/fish/completions`. The exact path to the last two of these may be slightly different depending on what install path prefix was chosen at configuration time. If a suitable file is found in one of these directories, it will be automatically loaded and the search will be stopped. The rationale behind having three different directories is that the first one is for user specific completions, the second one is for system-wide completions and the last one is for default fish completions. The default value for `$fish_complete_path` is `~/.config/fish/completions` `/etc/fish/completions` `/usr/share/fish/completions`. The exact path to the last two of these may be slightly different depending on what install path prefix was chosen at configuration time. If a suitable file is found in one of these directories, it will be automatically loaded and the search will be stopped. The rationale behind having three different directories is that the first one is for user specific completions, the second one is for system-wide completions and the last one is for default fish completions.
If you have written new completions for a common Unix command, please consider sharing your work by submitting it via the instructions in <a href="#more-help">Further help and development</a>. If you have written new completions for a common Unix command, please consider sharing your work by submitting it via the instructions in <a href="#more-help">Further help and development</a>.

View file

@ -1,7 +1,7 @@
\section isatty isatty - test if a file or file descriptor is a tty. \section isatty isatty - test if a file or file descriptor is a tty.
\subsection isatty-synopsis Synopsis \subsection isatty-synopsis Synopsis
\fish{syn} \fish{synopsis}
isatty [FILE | DEVICE | FILE DESCRIPTOR NUMBER] isatty [FILE | DEVICE | FILE DESCRIPTOR NUMBER]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section jobs jobs - print currently running jobs \section jobs jobs - print currently running jobs
\subsection jobs-synopsis Synopsis \subsection jobs-synopsis Synopsis
\fish{syn} \fish{synopsis}
jobs [OPTIONS] [PID] jobs [OPTIONS] [PID]
\endfish \endfish

View file

@ -2,7 +2,7 @@
\section math math - Perform mathematics calculations \section math math - Perform mathematics calculations
\subsection math-synopsis Synopsis \subsection math-synopsis Synopsis
\fish{syn} \fish{synopsis}
math EXPRESSION math EXPRESSION
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section mimedb mimedb - lookup file information via the mime database \section mimedb mimedb - lookup file information via the mime database
\subsection mimedb-synopsis Synopsis \subsection mimedb-synopsis Synopsis
\fish{syn} \fish{synopsis}
mimedb [OPTIONS] FILES... mimedb [OPTIONS] FILES...
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section nextd nextd - move forward through directory history \section nextd nextd - move forward through directory history
\subsection nextd-synopsis Synopsis \subsection nextd-synopsis Synopsis
\fish{syn} \fish{synopsis}
nextd [ -l | --list ] [POS] nextd [ -l | --list ] [POS]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section not not - negate the exit status of a job \section not not - negate the exit status of a job
\subsection not-synopsis Synopsis \subsection not-synopsis Synopsis
\fish{syn} \fish{synopsis}
not COMMAND [OPTIONS...] not COMMAND [OPTIONS...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section open open - open file in its default application \section open open - open file in its default application
\subsection open-synopsis Synopsis \subsection open-synopsis Synopsis
\fish{syn} \fish{synopsis}
open FILES... open FILES...
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section or or - conditionally execute a command \section or or - conditionally execute a command
\subsection or-synopsis Synopsis \subsection or-synopsis Synopsis
\fish{syn} \fish{synopsis}
COMMAND1; or COMMAND2 COMMAND1; or COMMAND2
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section popd popd - move through directory stack \section popd popd - move through directory stack
\subsection popd-synopsis Synopsis \subsection popd-synopsis Synopsis
\fish{syn} \fish{synopsis}
popd popd
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section prevd prevd - move backward through directory history \section prevd prevd - move backward through directory history
\subsection prevd-synopsis Synopsis \subsection prevd-synopsis Synopsis
\fish{syn} \fish{synopsis}
prevd [ -l | --list ] [POS] prevd [ -l | --list ] [POS]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section psub psub - perform process substitution \section psub psub - perform process substitution
\subsection psub-synopsis Synopsis \subsection psub-synopsis Synopsis
\fish{syn} \fish{synopsis}
COMMAND1 (COMMAND2|psub [-f]) COMMAND1 (COMMAND2|psub [-f])
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section pushd pushd - push directory to directory stack \section pushd pushd - push directory to directory stack
\subsection pushd-synopsis Synopsis \subsection pushd-synopsis Synopsis
\fish{syn} \fish{synopsis}
pushd [DIRECTORY] pushd [DIRECTORY]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section pwd pwd - output the current working directory \section pwd pwd - output the current working directory
\subsection pwd-synopsis Synopsis \subsection pwd-synopsis Synopsis
\fish{syn} \fish{synopsis}
pwd pwd
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section random random - generate random number \section random random - generate random number
\subsection random-synopsis Synopsis \subsection random-synopsis Synopsis
\fish{syn} \fish{synopsis}
random [SEED] random [SEED]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section read read - read line of input into variables \section read read - read line of input into variables
\subsection read-synopsis Synopsis \subsection read-synopsis Synopsis
\fish{syn} \fish{synopsis}
read [OPTIONS] [VARIABLES...] read [OPTIONS] [VARIABLES...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section return return - stop the current inner function \section return return - stop the current inner function
\subsection return-synopsis Synopsis \subsection return-synopsis Synopsis
\fish{syn} \fish{synopsis}
function NAME; [COMMANDS...;] return [STATUS]; [COMMANDS...;] end function NAME; [COMMANDS...;] return [STATUS]; [COMMANDS...;] end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section set set - display and change shell variables. \section set set - display and change shell variables.
\subsection set-synopsis Synopsis \subsection set-synopsis Synopsis
\fish{syn} \fish{synopsis}
set [SCOPE_OPTIONS] set [SCOPE_OPTIONS]
set [OPTIONS] VARIABLE_NAME VALUES... set [OPTIONS] VARIABLE_NAME VALUES...
set [OPTIONS] VARIABLE_NAME[INDICES]... VALUES... set [OPTIONS] VARIABLE_NAME[INDICES]... VALUES...

View file

@ -1,7 +1,7 @@
\section set_color set_color - set the terminal color \section set_color set_color - set the terminal color
\subsection set_color-synopsis Synopsis \subsection set_color-synopsis Synopsis
\fish{syn} \fish{synopsis}
set_color [-h|--help] [-b|--background COLOR] [COLOR] set_color [-h|--help] [-b|--background COLOR] [COLOR]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section source source - evaluate contents of file. \section source source - evaluate contents of file.
\subsection source-synopsis Synopsis \subsection source-synopsis Synopsis
\fish{syn} \fish{synopsis}
source FILENAME [ARGUMENTS...] source FILENAME [ARGUMENTS...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section status status - query fish runtime information \section status status - query fish runtime information
\subsection status-synopsis Synopsis \subsection status-synopsis Synopsis
\fish{syn} \fish{synopsis}
status [OPTION] status [OPTION]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section switch switch - conditionally execute a block of commands \section switch switch - conditionally execute a block of commands
\subsection switch-synopsis Synopsis \subsection switch-synopsis Synopsis
\fish{syn} \fish{synopsis}
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section test test - perform tests on files and text \section test test - perform tests on files and text
\subsection test-synopsis Synopsis \subsection test-synopsis Synopsis
\fish{syn} \fish{synopsis}
test [EXPRESSION] test [EXPRESSION]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section trap trap - perform an action when the shell receives a signal \section trap trap - perform an action when the shell receives a signal
\subsection trap-synopsis Synopsis \subsection trap-synopsis Synopsis
\fish{syn} \fish{synopsis}
trap [OPTIONS] [[ARG] SIGSPEC ... ] trap [OPTIONS] [[ARG] SIGSPEC ... ]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section type type - indicate how a command would be interpreted \section type type - indicate how a command would be interpreted
\subsection type-synopsis Synopsis \subsection type-synopsis Synopsis
\fish{syn} \fish{synopsis}
type [OPTIONS] NAME [NAME ...] type [OPTIONS] NAME [NAME ...]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section ulimit ulimit - set or get resource usage limits \section ulimit ulimit - set or get resource usage limits
\subsection ulimit-synopsis Synopsis \subsection ulimit-synopsis Synopsis
\fish{syn} \fish{synopsis}
ulimit [OPTIONS] [LIMIT] ulimit [OPTIONS] [LIMIT]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section umask umask - set or get the file creation mode mask \section umask umask - set or get the file creation mode mask
\subsection umask-synopsis Synopsis \subsection umask-synopsis Synopsis
\fish{syn} \fish{synopsis}
umask [OPTIONS] [MASK] umask [OPTIONS] [MASK]
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section vared vared - interactively edit the value of an environment variable \section vared vared - interactively edit the value of an environment variable
\subsection vared-synopsis Synopsis \subsection vared-synopsis Synopsis
\fish{syn} \fish{synopsis}
vared VARIABLE_NAME vared VARIABLE_NAME
\endfish \endfish

View file

@ -1,7 +1,7 @@
\section while while - perform a command multiple times \section while while - perform a command multiple times
\subsection while-synopsis Synopsis \subsection while-synopsis Synopsis
\fish{syn} \fish{synopsis}
while CONDITION; COMMANDS...; end while CONDITION; COMMANDS...; end
\endfish \endfish