Commit Graph

9148 Commits

Author SHA1 Message Date
Aaron Gyes
9e7034c903 fish.cpp: Dirs relative to CMAKE_SOURCE_DIR, don't assume 'fish'
This was causing problems if "fish" wasn't in exec_path, like
if the binary had been renamed.

I also noticed that even with 'fish' not renamed, only paths.data
was made relative to my source tree. paths.sysconf, paths.doc, and
paths.bin were all relative to /usr/local.
2018-11-25 14:37:12 -08:00
Fabian Homborg
40799d9e95 docs: Use fish_exit event instead of waiting for a process 2018-11-25 19:13:18 +01:00
Fabian Homborg
8ab6078001 docs: Remove the last mention of process expansion
See #5286.
2018-11-25 19:12:58 +01:00
Fabian Homborg
7e854e072a reader: Deduplicate some movements
This had a bunch of "do_{backward,forward}" movements that differed
only in one argument.

Just keep them together, so it's less code, and less needs to be
changed.
2018-11-25 18:57:35 +01:00
Fabian Homborg
20099774a0 fish_clipboard_copy: Use selection, if any
See #5368.
2018-11-25 17:33:14 +01:00
Aaron Gyes
d065ff840d Fix switch statement 2018-11-25 07:50:10 -08:00
Aaron Gyes
4ceb21cf09 rm completions: update BSD options
lined up with {Open|Net|Free}BSD & Solaris manuals.
2018-11-25 06:08:24 -08:00
Aaron Gyes
a2212876a9 add a simple 'math' completion 2018-11-25 05:13:14 -08:00
Aaron Gyes
62c6a09f1c ls.fish: simplify the logic a little. 2018-11-25 03:43:53 -08:00
Aaron Gyes
c2ae163bfe ls completions: fix mistake. 2018-11-25 03:12:44 -08:00
Aaron Gyes
e89035d76c ls completions: Solaris too. BSD vs POSIX -o conflict fixes
- Solaris is super annoying
- Also, use ls not command ls:
  if I wrapped `gls` in a `ls` function, I'd want this.
2018-11-25 03:07:16 -08:00
Aaron Gyes
c1af29f641 __fish_config_interactive: tell complete that [ wraps test
We want to show our completions for the `[` (`test`) builtin, but
we don't want to create a [.fish.
2018-11-25 02:04:56 -08:00
Aaron Gyes
a4f27bea36 cp completions: Give not-GNU cp the floam treatment 2018-11-25 01:45:45 -08:00
Aaron Gyes
7d79d326b5 test completions: we accept floats now 2018-11-25 00:15:11 -08:00
Aaron Gyes
8d0e1f3bcc test completions: don't complete files for string tests, wrap [
also removed --help - test doesn't do that.
2018-11-25 00:08:59 -08:00
Aaron Gyes
cc3fd9cf8f mv completions: Correctness improvements and updates for GNU, BSD, Solaris mv
Reflect GNU mv from this decade,  and the options handled
by specific non-GNU OSes.
2018-11-24 23:32:44 -08:00
David Adam
19be5f31b8 CHANGELOG: improve some verbiage
[ci skip]
2018-11-24 22:08:10 +08:00
David Adam
2dab869b41 Restore legacy CMD_DURATION and FISH_VERSION variables
Work on #4154.

Effectively reverts fb8ae04f80.

Discussed extensively in
https://github.com/fish-shell/fish-shell/pull/5320
2018-11-24 12:37:26 +08:00
Aaron Gyes
ca46c556c3 ls completions: BSD fixes
`ls` was suggesting options that are are not valid for my system,
omitting options that are on my system. Different BSD OSes have
different option extensions, and some of them do conflict with eachother.

I carefully checked the manuals of netbsd, macos, freebsd, and openbsd
`ls` and made the completions show the right completions in full for them.

Some verbiage tweaks as well.
2018-11-23 10:31:51 -08:00
ridiculousfish
d6a5792ce2 Allow nested square brackets again
Code like echo $list[$var[1]] was producing an error because of
nested square brackets. Allow these brackets again.

Fixes #5362
2018-11-22 17:57:27 -08:00
Fabian Homborg
60fa9da3a7 Rewrite __fish_complete_proc
- No longer uses sed, sort, uniq, uname
- Stop doing too-clever filtering (e.g. the kernel thread stuff never
- really worked)
- Don't truncate for all OSen, instead just use the (correctly
- truncated) comm field.
2018-11-22 15:23:05 +01:00
Fabian Homborg
3a835ebd61 Make --help work
See #5361.
2018-11-22 12:43:35 +01:00
Fabian Homborg
b383e29a24 type: Make "--help" work
This tripped over argparse --min-args=1, but we already return 1 above
if there really is no argument.

Fixes #5361.
2018-11-22 12:27:25 +01:00
Fabian Homborg
c729a97c43 builtin_read: Remove --all-lines
This was unused and needed to be warned about in the docs. Remove it
so nobody stumbles over it.

Fixes #5332.
2018-11-20 16:56:52 +01:00
Aaron Gyes
fc9d8eec72 history expect tests: fix the tests.
The colors happening for the interactive tests didn't match the
expected output. For `history search` commands we test, have them
pipe through `cat` so the fishscript does not use a pager or try
to colorize.
2018-11-20 05:26:54 -08:00
Aaron Gyes
007d794b6e history: improve interactive pager experience
- Colorize history search output when interactive, using
  fish_indent. This is the same way we colorize `type` output.

- Ask less to act like `cat` if the output will fit in the
  terminal window, so it's less jaring with short output.

- history is viewed in a pager when interactive, but pagers
  typically strip escape codes. We accomplish the above by
  doing exactly what `git` does[1] when it has colored output
  for a pager:
        if $LESS is unset, set it to enable -R, -F, and -X options.
	if $LV is unset, set it to -c.

[1]: 398dd4bd03/pager.c (L87)
2018-11-20 05:01:12 -08:00
Fabian Homborg
7367e545f2 Revert "wrealpath: Fail for file/something"
Apparently macOS realpath is broken.

This reverts commit ca1c499069.
2018-11-19 09:12:26 +01:00
Mahmoud Al-Qudsi
3d557518d5 Replace 0/1 with true/false in calls to job_reap 2018-11-18 17:40:18 -06:00
Mahmoud Al-Qudsi
d0085cae3c Fix zombie job on failed redirection in exec_job
Closes #5346.
2018-11-18 17:40:18 -06:00
ridiculousfish
a8ce7bad7b Always pass in the working directory in path_get_cdpath
If the user is in a directory which has been unlinked, it is possible
for the path .. to not exist, relative to the working directory.
Always pass in the working directory (potentially virtual) to
path_get_cdpath; this ensures we check absolute paths and are immune
from issues if the working directory has been unlinked.

Also introduce a new function path_normalize_for_cd which normalizes the
"join point" of a path and a working directory. This allows us to 'cd' out of
a non-existent directory, but not cd into such a directory.

Fixes #5341
2018-11-18 14:36:42 -08:00
Fabian Homborg
1ab84ac62a Test setting readonly variables 2018-11-18 22:33:02 +01:00
Mahmoud Al-Qudsi
8730b482a7 Prevent zombie processes after disowned child procs exit
Closes #5346.
2018-11-18 15:27:58 -06:00
Fabian Homborg
58b29fb5d1 Revert "Remove unnecessary "string_set_contains" function"
I have no idea why this worked or passed the tests?

This reverts commit 1836e704c4.

Fixes #5349.
2018-11-18 22:25:17 +01:00
Aaron Gyes
4221d6c3e6 Realpath styling tweaks.
Add braces I forgot, improve comments, make line spacing more
consistent around if blocks.
2018-11-18 12:29:35 -08:00
Fabian Homborg
442eb028c1 wrealpath: Simplify
- Reuse the buffer
- Don't duplicate the code for no "/"
2018-11-18 20:30:26 +01:00
Fabian Homborg
ca1c499069 wrealpath: Fail for file/something
This incorrectly allowed "file/something" if file existed (as a file), because it
checked "afile".

Fixes #5352.
2018-11-18 20:30:21 +01:00
Aaron Gyes
b00b1af152 Improve realpath error reporting, fix a crasher
realpath() will return NULL and sets errno if it fails.
We asserted that realpath(".") does not fail. We also didn't really
check that it was successful. Made sure we'll get a perror telling
us about what went wrong if something like this happens again.

Updated tests and added test case

Fixes #5351
2018-11-18 09:35:58 -08:00
Mahmoud Al-Qudsi
59197d12e0 Better handling of cases where man is not installed
Thanks to @floam, adapted to reduce nesting.

Works around override of command-not-found handler in previous solution
(c.f. 13e025bdb0).
2018-11-17 22:05:48 -06:00
Fabian Homborg
7b21f1c3cb Revert "mount completions: don't truncate mounts with spaces in them"
This does not work with util-linux mount, because that prints a "type" in between.

This reverts commit 1c364722a7.
2018-11-17 14:06:15 +01:00
Aaron Gyes
1c364722a7 mount completions: don't truncate mounts with spaces in them 2018-11-17 04:46:25 -08:00
Mahmoud Al-Qudsi
31d17f4559 Rename string escape --style=pcre2 to string escape --style=regex 2018-11-16 20:22:06 -06:00
Mahmoud Al-Qudsi
13e025bdb0 Clean up error message for man wrapper when man isn't installed
Closes #5329
2018-11-16 20:04:43 -06:00
Wojciech Siewierski
75515a4917 Update the docs regarding floats support in test (#5344)
* Replace "env" with "expr" in the test manpage

I'm pretty sure `env` isn't capable of comparing numbers and the author meant `expr`.

* Update the docs regarding floats support in test
2018-11-16 13:32:15 +01:00
Mahmoud Al-Qudsi
ab0f1d33fe Make use of the new PCRE2 escaping feature
Fixes some potentially unsafe uses of direct substitution into regex
expressions and also switches some completions to regex-based now that
there is a safe way of using it.
2018-11-15 12:37:29 -06:00
Mahmoud Al-Qudsi
680040d17d Document new PCRE2 string escaping in CHANGELOG and string.txt 2018-11-15 12:00:56 -06:00
Mahmoud Al-Qudsi
e160cde606 Implement PCRE2 escaping
Closes #5309.
2018-11-15 12:00:56 -06:00
Mahmoud Al-Qudsi
f56c317bd0 Add note about literal 0 indices to changelog
[ci skip]
2018-11-14 23:35:03 -06:00
Fabian Homborg
1fffdbce79 Fix status current-command
As it turns out, this just always printed "fish".

The solution here is a bit hacky as we go via the $_ variable.

Fixes #5339.
2018-11-14 12:15:40 +01:00
Fabian Homborg
278cbc5ff1 env_universal_common: Constref env_var_t as well 2018-11-14 12:15:40 +01:00
Fabian Homborg
8343e61795 cppcheck: Suppress incorrectStringBooleanError
This triggers on `assert(condition && "message")`, which we use
fairly frequently.
2018-11-14 12:15:40 +01:00