Skip to content

Commit

Permalink
Merge branch 'master' into issue_4848
Browse files Browse the repository at this point in the history
  • Loading branch information
faho committed May 11, 2018
2 parents 233738d + 9929acd commit 7c5297e
Show file tree
Hide file tree
Showing 247 changed files with 2,882 additions and 1,824 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -21,6 +21,7 @@
*.o
*.obj
*.orig
!tests/*.out
*.out
*.pch
*.slo
Expand Down
28 changes: 22 additions & 6 deletions CHANGELOG.md
Expand Up @@ -4,21 +4,25 @@ This section is for changes merged to the `major` branch that are not also merge
## Deprecations
- The `IFS` variable is deprecated and will be removed in fish 4.0 (#4156).
- The `function --on-process-exit` event will be removed in future (#4700). Use the `fish_exit` event instead.
- `$_` is deprecated and will removed in the future (#813). Use `status current-command` in a subshell instead.
- `^` as a redirection deprecated and will be removed in the future. (#4394). Use `2>` to redirect stderr. This is controlled by the `stderr-nocaret` feature flag.
- `?` as a glob is deprecated and will be removed in the future. (#4520). This is controlled by the `qmark-noglob` feature flag.

## Notable non-backward compatible changes
- `.` command no longer exists -- use `source` (#4294).
- `read` now uses `-s` as short for `--silent` (à la `bash`); `--shell`'s abbreviation (formerly `-s`) is now `-S` instead (#4490).
- `set x[1] x[2] a b` is no longer valid syntax (#4236).
- `for` loop control variables are no longer local to the `for` block (#1935).
- A literal `{}` now expands to itself, rather than nothing. This makes working with `find -exec` easier. (#1109, #4632)
- Successive commas in brace expansions are handled in less surprising manner (`{,,,}` expands to four empty strings rather than an empty string, a comma and an empty string again). (#3002, #4632).
- `%` is no longer used for process and job expansion. `$pid` and `$last_pid` have taken the place of `%self` and `%last` respectively. (#4230, #1202)
- `%` is no longer used for process and job expansion. `$fish_pid` and `$last_pid` have taken the place of `%self` and `%last` respectively. (#4230, #1202)
- The new `math` builtin (see below) does not support logical expressions; `test` should be used instead (#4777).

## Notable fixes and improvements
- A new feature flags mechanism is added for staging deprecations and breaking changes. (#4940)
- `wait` builtin is added for waiting on processes (#4498).
- `read` has a new `--delimiter` option as a better alternative to the `IFS` variable (#4256).
- `read` writes directly to stdout if called without arguments (#4407)
- `read` can now read one or more individual lines from the input stream without consuming the input in its entirety via `read -L/--line`. Refer to the `read` documentation for more info.
- `set` has a new `--append` and `--prepend` option (#1326).
- `set` has a new `--show` option to show lots of information about variables (#4265).
- `complete` now has a `-k` and `--keep-order` option to keep the order of the `OPTION_ARGUMENTS` (#361).
Expand All @@ -31,6 +35,7 @@ This section is for changes merged to the `major` branch that are not also merge
- `bind` has a new `--silent` option to ignore bind requests for named keys not available under the current `$TERMINAL` (#4188, #4431)
- Globs are faster (#4579)
- `string` reads from stdin faster (#4610)
- `string split` supports `-n/--no-empty` to exclude empty strings from the result (#4779)
- `cd` tab completions no longer descend into the deepest unambiguous path (#4649)
- Setting `$PATH` no longer warns on non-existent directories, allowing for a single $PATH to be shared across machines (e.g. via dotfiles).
- `funced` now has a `-s` and `--save` option to automatically save the edited function after successfully editing (#4668).
Expand All @@ -48,20 +53,31 @@ This section is for changes merged to the `major` branch that are not also merge
- fish now supports `&&`, `||`, and `!` (#4620).
- The machine hostname, where available, is now exposed as `$hostname` which is now a reserved variable. This drops the dependency on the `hostname` executable (#4422).
- `functions --handlers` can be used to show event handlers (#4694).
- Variables set in `if` and `while` conditions are available outside the block (#4820).
- The universal variables file no longer contains the MAC address. It is now at the fixed location `.config/fish/fish_universal_variables` (#1912).
- `alias` now has a `-s` and `--save` option to save the function generated by the alias using `funcsave` (#4878).

## Other significant changes
- Command substitution output is now limited to 10 MB by default (#3822).
- Added completions for
- `j` (autojump #4344)
- `bd` (#4472)
- `bower`<sup>&#x2217;</sup>
- `configure`
- `j` (autojump #4344)
- `jhipster` (#4472)
- `ngrok` (#4642)
 - `port`
- `optipng`
- `port`
- Improved completions for
- `git` (#4395, #4396, #4592)
- `brew`
- `diskutil`
- `yarn`
- `git` (#4395, #4396, #4592)
- `npm`<sup>†</sup>
- `ssh` (#4344)
- `yarn`<sup>&#x2217;</sup><sup>†</sup>

&#x2217; _`jq` must be installed to complete the list of currently installed `bower` or `yarn` packages_. <br/>
_to autocomplete the list of packages available for installation with `npm` or `yarn`, `all-the-package-names` must be installed (typically: `sudo npm install -g all-the-package-names`)._

--

Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -58,6 +58,7 @@ SET(FISH_SRCS
src/postfork.cpp src/proc.cpp src/reader.cpp src/sanity.cpp src/screen.cpp
src/signal.cpp src/tnode.cpp src/tokenizer.cpp src/utf8.cpp src/util.cpp
src/wcstringutil.cpp src/wgetopt.cpp src/wildcard.cpp src/wutil.cpp
src/future_feature_flags.cpp
)

# Header files are just globbed.
Expand Down Expand Up @@ -90,6 +91,13 @@ SET_SOURCE_FILES_PROPERTIES(src/fish_version.cpp
PROPERTIES OBJECT_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/${FBVF})

OPTION(INTERNAL_WCWIDTH "use fallback wcwidth" ON)
IF(INTERNAL_WCWIDTH)
add_definitions(-DHAVE_BROKEN_WCWIDTH=1)
ELSE()
add_definitions(-DHAVE_BROKEN_WCWIDTH=0)
ENDIF()

# Set up PCRE2
INCLUDE(cmake/PCRE2.cmake)

Expand Down
5 changes: 3 additions & 2 deletions Makefile.in
Expand Up @@ -118,7 +118,8 @@ FISH_OBJS := obj/autoload.o obj/builtin.o obj/builtin_bg.o obj/builtin_bind.o ob
obj/parse_productions.o obj/parse_tree.o obj/parse_util.o obj/parser.o \
obj/parser_keywords.o obj/path.o obj/postfork.o obj/proc.o obj/reader.o \
obj/sanity.o obj/screen.o obj/signal.o obj/tinyexpr.o obj/tokenizer.o obj/tnode.o obj/utf8.o \
obj/util.o obj/wcstringutil.o obj/wgetopt.o obj/wildcard.o obj/wutil.o
obj/util.o obj/wcstringutil.o obj/wgetopt.o obj/wildcard.o obj/wutil.o \
obj/future_feature_flags.o

FISH_INDENT_OBJS := obj/fish_indent.o obj/print_help.o $(FISH_OBJS)

Expand Down Expand Up @@ -467,7 +468,7 @@ doc.h: $(HDR_FILES)
#
%.gmo:
@echo " msgfmt $(em)$@$(sgr0)"
$v msgfmt --use-fuzzy -o $@ $*.po
$v msgfmt -o $@ $*.po

#
# Update existing po file or copy messages.pot
Expand Down
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -13,6 +13,10 @@ fish generally works like other shells, like bash or zsh. A few important differ

Detailed user documentation is available by running `help` within fish, and also at <https://fishshell.com/docs/current/index.html>

You can quickly play with fish right in your browser by clicking the button below:

[![Try in browser](https://cdn.rawgit.com/rootnroll/library/assets/try.svg)](https://rootnroll.com/d/fish-shell/)

## Getting fish

### macOS
Expand Down
3 changes: 2 additions & 1 deletion build_tools/build_toc_txt.sh
Expand Up @@ -12,5 +12,6 @@ for i in $@; do
NAME=`basename $NAME .hdr.in`
env sed <$i >>toc.txt -n \
-e 's,.*\\page *\([^ ]*\) *\(.*\)$,- <a href="'$NAME'.html" id="toc-'$NAME'">\2</a>,p' \
-e 's,.*\\section *\([^ ]*\) *\([^-]*\)\(.*\)$, - <a href="'$NAME'.html#\1">\2</a>,p'
-e 's,.*\\section *\([^ ]*\) *\(.*\) - .*$, - <a href="'$NAME'.html#\1">\2</a>,p' \
-e 's,.*\\section *\([^ ]*\) *\(.*\)$, - <a href="'$NAME'.html#\1">\2</a>,p'
done
4 changes: 2 additions & 2 deletions build_tools/list_committers_since.fish
Expand Up @@ -20,8 +20,8 @@ set committers_from_tag (mktemp)
# Unicode collation tables mean that this is fraught with danger; for example, the
# "“" character will not case-fold in UTF-8 locales. sort suggests using the C locale!

git log "$TAG" --format="%aN" --reverse | sort | uniq > $committers_to_tag
git log "$TAG".. --format="%aN" --reverse | sort | uniq > $committers_from_tag
git log "$TAG" --format="%aN" --reverse | sort -u > $committers_to_tag
git log "$TAG".. --format="%aN" --reverse | sort -u > $committers_from_tag

echo New committers:
echo (comm -13 $committers_to_tag $committers_from_tag)','
Expand Down
19 changes: 16 additions & 3 deletions cmake/Docs.cmake
Expand Up @@ -68,8 +68,10 @@ IF(BUILD_DOCS)
DEPENDS ${FUNCTIONS_DIR_FILES} ${COMPLETIONS_DIR_FILES}
doc_src/commands.hdr ${CMAKE_CURRENT_SOURCE_DIR}/lexicon_filter.in
share/functions/__fish_config_interactive.fish
build_tools/build_lexicon_filter.sh)
build_tools/build_lexicon_filter.sh command_list_toc.txt)

# Other targets should depend on this target, otherwise the lexicon
# filter can be built twice.
ADD_CUSTOM_TARGET(build_lexicon_filter DEPENDS lexicon_filter)

#
Expand Down Expand Up @@ -118,7 +120,7 @@ IF(BUILD_DOCS)
# @echo " doxygen $(em)user_doc$(sgr0)"
# $v (cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | doxygen - && touch user_doc
# $v rm -f $(wildcard $(addprefix ./user_doc/html/,arrow*.png bc_s.png bdwn.png closed.png doc.png folder*.png ftv2*.png nav*.png open.png splitbar.png sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html))
ADD_CUSTOM_TARGET(doc
ADD_CUSTOM_TARGET(doc ALL
COMMAND env `cat ${FBVF}`
${CMAKE_CURRENT_SOURCE_DIR}/build_tools/build_user_doc.sh
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.user ./lexicon_filter
Expand All @@ -127,11 +129,22 @@ IF(BUILD_DOCS)
ADD_CUSTOM_COMMAND(OUTPUT share/man/
COMMAND env `cat ${FBVF} | tr -d '\"' `
INPUT_FILTER=lexicon_filter ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/build_documentation.sh ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.help doc_src ./share
DEPENDS ${CFBVF} ${HELP_SRC} ${CMAKE_CURRENT_BINARY_DIR}/lexicon_filter)
DEPENDS ${CFBVF} ${HELP_SRC} build_lexicon_filter)

ADD_CUSTOM_TARGET(BUILD_MANUALS ALL DEPENDS share/man/)

# Group docs targets into a DocsTargets folder
SET_PROPERTY(TARGET doc BUILD_MANUALS build_lexicon_filter
PROPERTY FOLDER cmake/DocTargets)
ELSEIF(HAVE_PREBUILT_DOCS)
IF(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
# Out of tree build - link the prebuilt documentation to the build tree
ADD_CUSTOM_TARGET(link_doc ALL)
ADD_CUSTOM_COMMAND(TARGET link_doc
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/share/man ${CMAKE_CURRENT_BINARY_DIR}/share/man
POST_BUILD)
ADD_CUSTOM_COMMAND(TARGET link_doc
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/user_doc ${CMAKE_CURRENT_BINARY_DIR}/user_doc
POST_BUILD)
ENDIF()
ENDIF(BUILD_DOCS)
50 changes: 26 additions & 24 deletions cmake/Install.cmake
Expand Up @@ -25,30 +25,29 @@ SET(configure_input
DO NOT MANUALLY EDIT THIS FILE!")

SET(extra_completionsdir
${rel_datadir}/fish/vendor_completions.d
${datadir}/fish/vendor_completions.d
CACHE STRING "Path for extra completions")

SET(extra_functionsdir
${rel_datadir}/fish/vendor_functions.d
${datadir}/fish/vendor_functions.d
CACHE STRING "Path for extra completions")

SET(extra_confdir
${rel_datadir}/fish/vendor_conf.d
${datadir}/fish/vendor_conf.d
CACHE STRING "Path for extra configuration")

# These are the man pages that go in system manpath.
# These are the man pages that go in system manpath; all manpages go in the fish-specific manpath.
SET(MANUALS ${CMAKE_CURRENT_BINARY_DIR}/share/man/man1/fish.1
${CMAKE_CURRENT_BINARY_DIR}/share/man/man1/fish_indent.1
${CMAKE_CURRENT_BINARY_DIR}/share/man/man1/fish_key_reader.1)

# These are the manpages that go in fish-specific manpath.
FILE(GLOB HELP_MANPAGES share/man/man1/*.1)

# Determine which man pages we don't want to install.
# Determine which man page we don't want to install.
# On OS X, don't install a man page for open, since we defeat fish's open
# function on OS X.
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
LIST(REMOVE_ITEM HELP_MANPAGES share/man/man1/open.1)
SET(CONDEMNED_PAGE "open.1")
ELSE()
SET(CONDEMNED_PAGE "none")
ENDIF()

# Define a function to help us create directories.
Expand All @@ -60,6 +59,14 @@ FUNCTION(FISH_CREATE_DIRS)
ENDFOREACH(dir)
ENDFUNCTION(FISH_CREATE_DIRS)

FUNCTION(FISH_TRY_REMOVE)
FOREACH(dir ${ARGV})
IF(EXISTS ${CMAKE_INSTALL_PREFIX}/${dir})
FILE(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/${dir})
ENDIF()
ENDFOREACH()
ENDFUNCTION(FISH_TRY_REMOVE)

FUNCTION(FISH_TRY_CREATE_DIRS)
FOREACH(dir ${ARGV})
IF(NOT IS_ABSOLUTE ${dir})
Expand Down Expand Up @@ -91,16 +98,8 @@ INSTALL(TARGETS ${PROGRAMS}
FISH_CREATE_DIRS(${sysconfdir}/fish/conf.d)
INSTALL(FILES etc/config.fish DESTINATION ${sysconfdir}/fish/)

# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/groff
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/man/man1
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/js
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/partials
# $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts
FISH_TRY_REMOVE(${rel_datadir}/fish)

FISH_CREATE_DIRS(${rel_datadir}/fish ${rel_datadir}/fish/completions
${rel_datadir}/fish/functions ${rel_datadir}/fish/groff
${rel_datadir}/fish/man/man1 ${rel_datadir}/fish/tools
Expand Down Expand Up @@ -132,7 +131,7 @@ CONFIGURE_FILE(fish.pc.in fish.pc.noversion)

ADD_CUSTOM_COMMAND(OUTPUT fish.pc
COMMAND sed '/Version/d' fish.pc.noversion > fish.pc
COMMAND echo -n "Version: " >> fish.pc
COMMAND printf "Version: " >> fish.pc
COMMAND sed 's/FISH_BUILD_VERSION=//\;s/\"//g' ${FBVF} >> fish.pc
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FBVF} ${CMAKE_CURRENT_BINARY_DIR}/fish.pc.noversion)
Expand Down Expand Up @@ -160,10 +159,13 @@ INSTALL(DIRECTORY share/groff
DESTINATION ${rel_datadir}/fish)

# $v test -z "$(wildcard share/man/man1/*.1)" || $(INSTALL) -m 644 $(filter-out $(addprefix share/man/man1/, $(CONDEMNED_PAGES)), $(wildcard share/man/man1/*.1)) $(DESTDIR)$(datadir)/fish/man/man1/
# CONDEMNED_PAGES is managed by the LIST() function after the glob
# CONDEMNED_PAGE is managed by the conditional above
# Building the man pages is optional: if doxygen isn't installed, they're not built
INSTALL(FILES ${HELP_MANPAGES}
DESTINATION ${rel_datadir}/fish/man/man1)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/share/man/man1/
DESTINATION ${rel_datadir}/fish/man/man1
FILES_MATCHING
PATTERN "*.1"
PATTERN ${CONDEMNED_PAGE} EXCLUDE)

# @echo "Installing helper tools";
# $v $(INSTALL) -m 755 share/tools/*.py $(DESTDIR)$(datadir)/fish/tools/
Expand Down Expand Up @@ -204,7 +206,7 @@ INSTALL(FILES ${MANUALS} DESTINATION ${mandir}/man1/ OPTIONAL)
# fi; \
# done;
# Building the manual is optional
INSTALL(DIRECTORY user_doc/html/ # Trailing slash is important!
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/user_doc/html/ # Trailing slash is important!
DESTINATION ${docdir} OPTIONAL)
INSTALL(FILES CHANGELOG.md DESTINATION ${docdir})

Expand Down
15 changes: 15 additions & 0 deletions configure.ac
Expand Up @@ -25,6 +25,7 @@ AC_SUBST(HAVE_DOXYGEN)
AC_SUBST(LDFLAGS_FISH)
AC_SUBST(WCHAR_T_BITS)
AC_SUBST(EXTRA_PCRE2)
AC_SUBST(HAVE_BROKEN_WCWIDTH)

#
# If needed, run autoconf to regenerate the configure file
Expand Down Expand Up @@ -599,6 +600,20 @@ AC_ARG_WITH(
[included_pcre2=auto]
)

HAVE_BROKEN_WCWIDTH=
AC_ARG_ENABLE(
[wcwidth],
AS_HELP_STRING(
[--disable-internal-wcwidth],
[use system wcwidth instead of the bundled version]
))

if test "x$enable_wcwidth" != "xno"; then
AC_DEFINE([HAVE_BROKEN_WCWIDTH], [1], [banana])
else
AC_DEFINE([HAVE_BROKEN_WCWIDTH], [0], [banana])
fi

if test "x$included_pcre2" != "xyes"; then

# test for pcre2-config
Expand Down
10 changes: 8 additions & 2 deletions doc_src/alias.txt
Expand Up @@ -3,8 +3,8 @@
\subsection alias-synopsis Synopsis
\fish{synopsis}
alias
alias NAME DEFINITION
alias NAME=DEFINITION
alias [OPTIONS] NAME DEFINITION
alias [OPTIONS] NAME=DEFINITION
\endfish

\subsection alias-description Description
Expand All @@ -18,6 +18,12 @@ alias NAME=DEFINITION

You cannot create an alias to a function with the same name. Note that spaces need to be escaped in the call to `alias` just like at the command line, _even inside quoted parts_.

The following options are available:

- `-h` or `--help` displays help about using this command.

- `-s` or `--save` Automatically save the function created by the alias into your fish configuration directory using <a href='#funcsave'>funcsave</a>.

\subsection alias-example Example

The following code will create `rmi`, which runs `rm` with additional arguments on every invocation.
Expand Down

0 comments on commit 7c5297e

Please sign in to comment.