diff --git a/.gitattributes b/.gitattributes index 6f346fba8..94ef0ab2d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,20 @@ .gitattributes export-ignore .gitignore export-ignore -/build_tools export-ignore +/build_tools/make_svn_completions.fish export-ignore +/build_tools/description-pak export-ignore +/build_tools/make_hg_completions.fish export-ignore +/build_tools/make_vcs_completions.fish export-ignore +/build_tools/make_vcs_completions_generic.fish export-ignore +/build_tools/osx_package_resources export-ignore +/build_tools/osx_package_resources/terminal_logo.png export-ignore +/build_tools/osx_package_resources/welcome.rtf export-ignore +/build_tools/make_csv_completions.fish export-ignore +/build_tools/osx_distribution.xml export-ignore +/build_tools/make_tarball.sh export-ignore +/build_tools/make_deb.sh export-ignore +/build_tools/osx_package_scripts export-ignore +/build_tools/osx_package_scripts/add-shell export-ignore +/build_tools/osx_package_scripts/postinstall export-ignore +/build_tools/make_pkg.sh export-ignore +/build_tools/make_darcs_completions.fish export-ignore diff --git a/.gitignore b/.gitignore index a9fe03cbe..b2ea73dc2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ *.o *~ +*.exe -Doxyfile.help Makefile autom4te.cache/ build/ @@ -12,6 +12,7 @@ config.h.in config.log config.status configure +doc/ doc.h doc_src/commands.hdr doc_src/index.hdr @@ -32,3 +33,5 @@ user_doc/ xcuserdata tests/*tmp.* tests/foo.txt +FISH-BUILD-VERSION-FILE +version diff --git a/STYLEGUIDE.md b/CONTRIBUTING.md similarity index 100% rename from STYLEGUIDE.md rename to CONTRIBUTING.md diff --git a/Makefile.in b/Makefile.in index c36cbe7d6..07dec023c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -153,9 +153,10 @@ MIME_OBJS := mimedb.o print_help.o xdgmimealias.o xdgmime.o \ # # These files are the source files, they contain a few @FOO@-style substitutions +# Note that this order defines the order that they appear in the documentation # -HDR_FILES_SRC := doc_src/index.hdr.in doc_src/commands.hdr.in doc_src/design.hdr doc_src/license.hdr doc_src/faq.hdr +HDR_FILES_SRC := doc_src/index.hdr.in doc_src/tutorial.hdr doc_src/design.hdr doc_src/license.hdr doc_src/commands.hdr.in doc_src/faq.hdr # @@ -269,19 +270,32 @@ TRANSLATIONS := $(TRANSLATIONS_SRC:.po=.gmo) ifeq ($(HAVE_DOXYGEN), 1) user_doc=user_doc + share_man=share/man else user_doc= + share_man= endif # # Make everything needed for installing fish # -all: $(PROGRAMS) $(user_doc) share/man $(TRANSLATIONS) +all: $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) @echo fish has now been built. @echo Use \'$(MAKE) install\' to install fish. .PHONY: all +# +# Pull version information +# + +FISH-BUILD-VERSION-FILE: FORCE + @./build_tools/git_version_gen.sh +-include FISH-BUILD-VERSION-FILE +CPPFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\" +.PHONY: FORCE +env.o fish.o fish_indent.o fish_pager.o fishd.o mimedb.o: FISH-BUILD-VERSION-FILE + # # These dependencies make sure that autoconf and configure are run @@ -311,9 +325,11 @@ prof: all # Depend on the sources (*.hdr.in) and manually make the # intermediate *.hdr and doc.h files if needed +# The sed command deletes everything including and after the first -, for simpler version numbers user_doc: $(HDR_FILES_SRC) Doxyfile.user user_doc.head.html $(HELP_SRC) doc.h $(HDR_FILES) - (cat Doxyfile.user ; echo PROJECT_NUMBER=@PACKAGE_VERSION@) | doxygen - && touch user_doc + (cat Doxyfile.user ; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | sed "s/-.*//") | doxygen - && touch user_doc + # @@ -321,7 +337,7 @@ user_doc: $(HDR_FILES_SRC) Doxyfile.user user_doc.head.html $(HELP_SRC) doc.h $( # doc: *.h *.cpp doc.h Doxyfile - (cat Doxyfile ; echo PROJECT_NUMBER=@PACKAGE_VERSION@) | doxygen - ; + (cat Doxyfile ; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION)) | doxygen - ; # @@ -351,26 +367,34 @@ test: $(PROGRAMS) fish_tests # doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in - -rm command_list.tmp $@ + -rm command_list.tmp command_list_toc.tmp $@ for i in `printf "%s\n" $(HELP_SRC)|sort`; do \ echo "
''). It will be used whenever no
@@ -46,9 +46,13 @@ bind to the function name. This way it becomes significantly easier to
test the function while editing, and the result is usually more
readable as well.
+If such a script produces output, the script needs to finish by
+calling 'commandline -f repaint' in order to tell fish that a repaint
+is in order.
+
Key bindings are not saved between sessions by default. To save custom
keybindings, edit the \c fish_user_key_bindings function and insert the
-appropirate \c bind statements.
+appropriate \c bind statements.
The following parameters are available:
@@ -56,6 +60,35 @@ The following parameters are available:
- -K or --key-names Display a list of available key names
- -f or --function-names Display a list of available input functions
+The following special input functions are available:
+
+- \c backward-char, moves one character to the left
+- \c backward-delete-char, deletes one character of input to the left of the cursor
+- \c backward-kill-line, move everything from the beginning of the line to the cursor to the killring
+- \c backward-kill-word, move the word to the left of the cursor to the killring
+- \c backward-word, move one word to the left
+- \c beginning-of-history, move to the beginning of the history
+- \c beginning-of-line, move to the beginning of the line
+- \c capitalize-word, make the current word begin with a capital letter
+- \c complete, guess the remainder of the current token
+- \c delete-char, delete one character to the right of the cursor
+- \c delete-line, delete the entire line
+- \c downcase-word, make the current word lowercase
+- \c dump-functions, print a list of all key-bindings
+- \c end-of-history, move to the end of the history
+- \c end-of-line, move to the end of the line
+- \c explain, print a description of possible problems with the current command
+- \c forward-char, move one character to the right
+- \c forward-word, move one word to the right
+- \c history-search-backward, search the history for the previous match
+- \c history-search-forward, search the history for the next match
+- \c kill-line, move everything from the cursor to the end of the line to the killring
+- \c kill-whole-line, move the line to the killring
+- \c kill-word, move the next word to the killring
+- \c upcase-word, make the current word uppercase
+- \c yank, insert the latest entry of the killring into the buffer
+- \c yank-pop, rotate to the previous entry of the killring
+
\subsection bind-example Examples
bind \\cd 'exit' causes \c fish to exit when Control-d is pressed.
diff --git a/doc_src/commands.hdr.in b/doc_src/commands.hdr.in
index b62a6d568..c29675bd6 100644
--- a/doc_src/commands.hdr.in
+++ b/doc_src/commands.hdr.in
@@ -1,6 +1,15 @@
-/** \page commands Commands, functions and builtins bundled with fish
-Fish ships with a large number of builtin commands, shellscript functions and external commands. These are all described below.
+/** \page commands Commands bundled with fish
+\htmlonly \endhtmlonly
+
+\htmlonly
+ \endhtmlonly
*/
diff --git a/doc_src/design.hdr b/doc_src/design.hdr
index f1047546e..b0b4635ff 100644
--- a/doc_src/design.hdr
+++ b/doc_src/design.hdr
@@ -1,5 +1,7 @@
/** \page design Design document
+\htmlonly \endhtmlonly
diff --git a/doc_src/faq.hdr b/doc_src/faq.hdr
index 449c10f4f..c727dd5da 100644
--- a/doc_src/faq.hdr
+++ b/doc_src/faq.hdr
@@ -1,5 +1,7 @@
/** \page faq Frequently asked questions
+\htmlonly
+
+\endhtmlonly
diff --git a/doc_src/fish_config.txt b/doc_src/fish_config.txt
index a9627bb23..777f25225 100644
--- a/doc_src/fish_config.txt
+++ b/doc_src/fish_config.txt
@@ -11,7 +11,7 @@ to make changes to your prompt and color configuration.
you have finished, close the browser window and then press the Enter key to
terminate the configuration session.
-There are no parameters for fish_config.
+fish_config optionally accepts name of the initial configuration tab. For e.g. fish_config history will start configuration interface with history tab.
If the \c BROWSER environment variable is set, it will be used as the name
of the web browser to open instead of the system default.
diff --git a/doc_src/function.txt b/doc_src/function.txt
index c072c5518..8d8e45193 100644
--- a/doc_src/function.txt
+++ b/doc_src/function.txt
@@ -12,16 +12,19 @@ function is given as a command.
The following options are available:
+- -a NAMES or --argument-names NAMES assigns the value of successive command-line arguments to the names given in NAMES.
- -d DESCRIPTION or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description.
- -e or --on-event EVENT_NAME tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
- -j PID or --on-job-exit PID tells fish to run this function when the job with group ID PID exits. Instead of PID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
- -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 signal number, or the signal name, such as SIGHUP (or just HUP).
+- \c -S or \c --no-scope-shadowing allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are "shadowed", and their contents is independent of the calling function.
- -v or --on-variable VARIABLE_NAME tells fish to run this function when the variable VARIABLE_NAME changes value.
If the user enters any additional arguments after the function, they
are inserted into the environment variable array
-$argv.
+$argv. If the \c --argument-names option is provided, the arguments are
+also assigned to names specified in that option.
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the emit builtin. Fish generates the following named events:
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index 9b674479d..f82f309aa 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -1,9 +1,12 @@
/** \mainpage Fish user documentation
-\section toc Table of contents
-
-- Fish user documentation
+\htmlonly \endhtmlonly
+
+\htmlonly
+ \endhtmlonly
diff --git a/doc_src/license.hdr b/doc_src/license.hdr
index 2225a0850..64bab10f0 100644
--- a/doc_src/license.hdr
+++ b/doc_src/license.hdr
@@ -1,5 +1,7 @@
/** \page license Licenses
+\htmlonly \endhtmlonly
diff --git a/doc_src/nextd.txt b/doc_src/nextd.txt
index dba94ce02..297063af9 100644
--- a/doc_src/nextd.txt
+++ b/doc_src/nextd.txt
@@ -12,7 +12,8 @@ directory history is also displayed.
\subsection nextd-example Example
-cd /usr/src +\code +cd /usr/src # Working directory is now /usr/src cd /usr/src/fish-shell # Working directory is now /usr/src/fish-shell @@ -20,3 +21,4 @@ prevd # Working directory is now /usr/src nextd # Working directory is now /usr/src/fish-shell+\endcode diff --git a/doc_src/prevd.txt b/doc_src/prevd.txt index b72fc3752..e49faff22 100644 --- a/doc_src/prevd.txt +++ b/doc_src/prevd.txt @@ -14,7 +14,8 @@ history is also displayed. \subsection prevd-example Example -
cd /usr/src +\code +cd /usr/src # Working directory is now /usr/src cd /usr/src/fish-shell # Working directory is now /usr/src/fish-shell @@ -22,3 +23,4 @@ prevd # Working directory is now /usr/src nextd # Working directory is now /usr/src/fish-shell+\endcode diff --git a/doc_src/source.txt b/doc_src/source.txt index 069583754..c49e24912 100644 --- a/doc_src/source.txt +++ b/doc_src/source.txt @@ -1,11 +1,11 @@ -\section source . - evaluate contents of file. +\section source source - evaluate contents of file. \subsection source-synopsis Synopsis -. FILENAME [ARGUMENTS...] +source FILENAME [ARGUMENTS...] \subsection source-description Description -\c . (source) evaluates the commands of the specified file in the current +\c source evaluates the commands of the specified file in the current shell. This is different from starting a new process to perform the commands (i.e. fish < FILENAME) since the commands will be evaluated by the current shell, which means that changes in @@ -16,11 +16,11 @@ variable. If no file is specified, or if the file name '-' is used, stdin will be read. -The return status of \c . is the return status of the last job to +The return status of \c source is the return status of the last job to execute. If something goes wrong while opening or reading the file, -\c . exits with a non-zero status. +\c source exits with a non-zero status. \subsection source-example Example -. ~/.config/fish/config.fish causes fish to re-read its initialization file. +source ~/.config/fish/config.fish causes fish to re-read its initialization file. diff --git a/doc_src/test.txt b/doc_src/test.txt index 600e7ea78..946c53307 100644 --- a/doc_src/test.txt +++ b/doc_src/test.txt @@ -6,37 +6,95 @@ \subsection test-description Description Tests the expression given and sets the exit status to 0 if true, -and 1 if false. +and 1 if false. An expression is made up of one or more operators +and their arguments. -The following options are available: -- \c -h displays a help message and then exits. -- -L FILE returns true if \c FILE is a symbolic link. -- -S FILE returns true if \c FILE is a socket. -- COND1 -a COND2 combines two conditions with a logical and. +The following operators are available to examine files and directories: - -b FILE returns true if \c FILE is a block device. - -c FILE returns true if \c FILE is a character device. - -d FILE returns true if \c FILE is a directory. - -e FILE returns true if \c FILE exists. - -f FILE returns true if \c FILE is a regular file. -- -f FILE returns true if \c FILE has set-group-ID bit set. -- -n STRING returns true if the length of \c STRING is non-zero. -- COND1 -o COND2 combines two conditions with a logical or. +- -g FILE returns true if \c FILE has the set-group-ID bit set. +- -G FILE returns true if \c FILE exists and has the same group ID +as the current user. +- -L FILE returns true if \c FILE is a symbolic link. +- -O FILE returns true if \c FILE exists and is owned by the current +user. - -p FILE returns true if \c FILE is a named pipe. -- -r FILE returns true if \c FILE is readable. -- -s FILE returns true if the size of \c FILE is non-zero. -- -t FD returns true if \c FD is a terminal (TTY). -- -u FILE returns true if \c FILE has set-user-ID bit set. -- -w FILE returns true if \c FILE is writable. -- -x FILE returns true if \c FILE is executable. -- -z STRING returns true if \c STRING length is zero. +- -r FILE returns true if \c FILE is marked as readable. +- -s FILE returns true if the size of \c FILE is greater than zero. +- -S FILE returns true if \c FILE is a socket. +- -t FD returns true if the file descriptor \c FD is a terminal (TTY). +- -u FILE returns true if \c FILE has the set-user-ID bit set. +- -w FILE returns true if \c FILE is marked as writable; note that this does not check if the filesystem is read-only. +- -x FILE returns true if \c FILE is marked as executable. -\subsection test-example Example +The following operators are available to compare and examine text strings: +- STRING1 = STRING2 returns true if the strings \c STRING1 and +\c STRING2 are identical. +- STRING1 != STRING2 returns true if the strings \c STRING1 and +\c STRING2 are not identical. +- -n STRING returns true if the length of \c STRING is non-zero. +- -z STRING returns true if the length of \c STRING is zero. + +The following operators are available to compare and examine numbers: +- NUM1 -eq NUM2 returns true if \c NUM1 and \c NUM2 are numerically equal. +- NUM1 -ne NUM2 returns true if \c NUM1 and \c NUM2 are not numerically equal. +- NUM1 -gt NUM2 returns true if \c NUM1 is greater than NUM2. +- NUM1 -ge NUM2 returns true if \c NUM1 is greater than or equal to NUM2. +- NUM1 -lt NUM2 returns true if \c NUM1 is less than NUM2. +- NUM1 -le NUM2 returns true if \c NUM1 is less than or equal to NUM2. + +Note that only integers are supported. For more complex mathematical +operations, including fractions, the \c env program may be useful. Consult the +documentation for your operating system. + +Expressions can be combined using the following operators: +- COND1 -a COND2 returns true if both \c COND1 and \c COND2 are true. +- COND1 -o COND2 returns true if either \c COND1 or \c COND2 are true. + +Expressions can be inverted using the \c ! operator: +- ! EXPRESSION returns true if \c EXPRESSION is false, and false if +\c EXPRESSION is true. + +Expressions can be grouped using parentheses. +- ( EXPRESSION ) returns the value of EXPRESSION. +Note that parentheses will usually require escaping with \\( to avoid +being interpreted as a command substitution. + +\subsection test-example Examples + +If the \c /tmp directory exists, copy the \c /etc/motd file to it:
-if test -d "/" - echo "Fish is cool" +if test -d /tmp + cp /etc/motd /tmp/motd end -+ + +If the variable \c MANPATH is defined and not empty, print the contents: + +
+if test -n $MANPATH + echo $MANPATH +end ++ +Parentheses and the \c -o and \c -a operators can be combined to produce +more complicated expressions. In this example, success is printed if there is +a \c /foo or \c /bar file as well as a \c /baz or \c /bat file. + +
+if test \\( -f /foo -o -f /bar \\) -a \\( -f /baz -o -f /bat \\) + echo Success. +end. ++ +\subsection test-standards Standards + +\c test implements a subset of the +IEEE Std 1003.1-2008 +(POSIX.1) standard. The following exceptions apply: +- The \c < and \c > operators for comparing strings are not implemented. -Because "/" is a directory, the expression will evaluate to true, and -"Fish is cool" will be output. diff --git a/doc_src/tutorial.hdr b/doc_src/tutorial.hdr new file mode 100644 index 000000000..d5cd69482 --- /dev/null +++ b/doc_src/tutorial.hdr @@ -0,0 +1,746 @@ +/** \page tutorial Tutorial + +\htmlonly + + + + + + + + \endhtmlonly diff --git a/env.cpp b/env.cpp index ddb5d2c4e..13f87b6cc 100644 --- a/env.cpp +++ b/env.cpp @@ -429,68 +429,15 @@ static void universal_callback(fish_message_type_t type, } /** - Make sure the PATH variable contains the essential directories + Make sure the PATH variable contains something */ static void setup_path() { - const wchar_t *path_el[] = + const env_var_t path = env_get_string(L"PATH"); + if (path.missing_or_empty()) { - L"/bin", - L"/usr/bin", - NULL - }; - - env_var_t path = env_get_string(L"PATH"); - - wcstring_list_t lst; - if (! path.missing()) - { - tokenize_variable_array(path, lst); - } - - for (size_t j=0; path_el[j] != NULL; j++) - { - - bool has_el = false; - - for (size_t i=0; i