From a31b44f9b221cf3be9abbcca31a48830259bc78f Mon Sep 17 00:00:00 2001 From: David Adam Date: Sun, 26 Oct 2014 19:01:22 +0800 Subject: [PATCH] contains: add documentation regarding the use of `--` Closes #1194. [skip ci] --- doc_src/contains.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc_src/contains.txt b/doc_src/contains.txt index f3966d82c..3b5060bad 100644 --- a/doc_src/contains.txt +++ b/doc_src/contains.txt @@ -13,6 +13,7 @@ The following options are available: - `-i` or `--index` print the word index +Note that, like GNU tools, `contains` interprets all arguments starting with a `-` as options to contains, until it reaches an argument that is `--` (two dashes). See the examples below. \subsection contains-example Example @@ -25,3 +26,13 @@ end \endfish The above code tests if `~/bin` and `/usr/local/bin` are in the path and adds them if not. + +\fish +function hasargs + if contains -- -q $argv + echo '$argv contains a -q option' + end +end +\endfish + +The above code checks for `-q` in the argument list, using the `--` argument to demarcate options to `contains` from the key to search for.