Commit Graph

11193 Commits

Author SHA1 Message Date
Johannes Altmanninger
f36705bb66 Fix error messages for "and" and "or" after pipe
Fixes #6347
2019-11-26 14:03:53 +01:00
Johannes Altmanninger
97969a9363 Restore error messages for bare variable assignment
Since #6287, bare variable assignments do not parse, which broke
the "Unsupported use of '='" error message.

This commit catches parse errors that occur on bare variable assignments.
When a statement node fails to parse, then we check if there is at least one
prefixing variable assignment. If so, we emit the old error message.

See also #6347
2019-11-26 13:59:17 +01:00
David Adam
563bdf3cc7 docs: update isatty documentation to refer to terminals
Use language that is more accurate, similar to what glibc uses.

Closes #6355.
2019-11-26 18:18:16 +08:00
David Adam
b8a9f2f228 docs: restore compatibility with Sphinx < 1.8.0 2019-11-26 18:17:20 +08:00
ridiculousfish
305409a025 Fix the vi mode bind test
Note support for the 'replace' mode.
2019-11-25 16:43:54 -08:00
ridiculousfish
d11a5088c5 Relnote vi replace mode #6342 2019-11-25 16:42:18 -08:00
0x005c
48dc9b1e82 Add replace mode in vi-mode 2019-11-25 16:05:10 -08:00
ridiculousfish
267b8da935 Remove dead function reconstruct_orig_str
This function is no longer called.
2019-11-25 15:52:30 -08:00
Rosen Penev
1102b83b2d builtin_printf: Use proper functions
Removes unnecessary type conversions.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:50:40 -08:00
Rosen Penev
69d0bb7c0d io.h: Add missing override
Found with clang's -Winconsistent-missing-destructor-override

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:50:40 -08:00
Rosen Penev
586ac3dfa7 [clang-tidy] Convert loops to range based
Found with modernize-loop-convert

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:50:40 -08:00
Rosen Penev
1055ff321c [clang-tidy] Replace NULL with nullptr
Found with modernize-use-nullptr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:23:03 -08:00
Rosen Penev
8d54e928cd [clang-tidy] C to C++ headers
Found with modernize-deprecated-headers

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:17:49 -08:00
Rosen Penev
0dfa7421f3 [clang-tidy] Convert C casts to C++ ones
Found with google-readability-casting

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:17:49 -08:00
Rosen Penev
7f62e30731 [clang-tidy] Replace size comparisons with empty
Found with readability-container-size-empty

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:13:33 -08:00
Rosen Penev
5ca80a61e3 [clang-tidy] Fix inconsistent declarations
Found with readability-inconsistent-declaration-parameter-name

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:13:33 -08:00
Osamu Aoki
435556001e "eval" example to use $cmd as an array
Signed-off-by: Osamu Aoki <osamu@debian.org>
2019-11-25 13:23:21 +01:00
Osamu Aoki
d7e545d89b "source" to identify itself as a "block" first
Signed-off-by: Osamu Aoki <osamu@debian.org>
2019-11-25 13:23:21 +01:00
Jason
3cf6ebc0e1 Amend typos and grammar errors 2019-11-25 13:07:15 +01:00
Johannes Altmanninger
7d5b44e828 Support FOO=bar syntax for passing variables to individual commands
This adds initial support for statements with prefixed variable assignments.
Statments like this are supported:

a=1 b=$a echo $b        # outputs 1

Just like in other shells, the left-hand side of each assignment must
be a valid variable identifier (no quoting/escaping).  Array indexing
(PATH[1]=/bin ls $PATH) is *not* yet supported, but can be added fairly
easily.

The right hand side may be any valid string token, like a command
substitution, or a brace expansion.

Since `a=* foo` is equivalent to `begin set -lx a *; foo; end`,
the assignment, like `set`, uses nullglob behavior, e.g. below command
can safely be used to check if a directory is empty.

x=/nothing/{,.}* test (count $x) -eq 0

Generic file completion is done after the equal sign, so for example
pressing tab after something like `HOME=/` completes files in the
root directory
Subcommand completion works, so something like
`GIT_DIR=repo.git and command git ` correctly calls git completions
(but the git completion does not use the variable as of now).

The variable assignment is highlighted like an argument.

Closes #6048
2019-11-25 09:20:51 +01:00
Rosen Penev
3b0f642de9 builtin-math: Use normal C trunc
uClibc-ng does not expose C++11 math
functions to the std namespace, breaking
compilation. This is fine as the argument
type is double.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-24 22:02:33 +01:00
ridiculousfish
80a4898e75 Revert "Migrate some iothread functions into member functions of thread_pool_t"
This reverts commit 22230a1a0d.
Also 9d7d70c204

There's some subtle bug here, needs to be tracked down and tested.
2019-11-23 23:35:34 -08:00
ridiculousfish
9023c2187f Make shutdown_fillthread_ a relaxed_atomic_bool_t
Reduces the noisiness of working with it.
2019-11-23 14:12:34 -08:00
ridiculousfish
22230a1a0d Migrate some iothread functions into member functions of thread_pool_t 2019-11-23 14:05:26 -08:00
ridiculousfish
9d7d70c204 Clean up some iothreads
Improve the iothread behavior by enabling an iothread to stick around for
a while waiting for work. This reduces the amount of iothread churn, which
is useful on platforms where threads are expensive.

Also do other modernization like clean up the locking discipline and use
FLOG.
2019-11-23 13:44:27 -08:00
ridiculousfish
a74fc7ef6d Remove the wait_for_threads_to_die parameter to execute_fork
This is always set to false so we can get rid of it.
2019-11-23 12:36:44 -08:00
ridiculousfish
3fb9159b09 Rename spawn_request_t to work_request_t and clean up the API a bit 2019-11-23 12:13:30 -08:00
ridiculousfish
03a289c9ef Add an aliases benchmark 2019-11-23 11:53:49 -08:00
Ray Hogenson
98a98b1424 Change vi selection mode to be inclusive
The current cursor position should be included in the selection to be
consistent with the behavior of vi.

Fixes #5770
2019-11-19 20:25:10 +01:00
Akatsuki
cb72a33e0c Fix some issues in __fish_complete_subcommand.fish
Fix 'string length: Unknown option': add `--` before $subcommand

Fix count $subcommand always = 1 with `sudo` and `doas`:
give argv as array to __fish_complete_subcommand

[ci skip]
2019-11-17 00:39:06 +01:00
Fabian Homborg
330f1701d7 Restyle
This mostly fixes some wrong indents or replaces some stray tab indents.

I excluded alignment on purpose, because we have a whole bunch of code
that goes like

```fish
complete -c foo -n 'some-condition'        -l someoption
complete -c foo -n 'some-longer-condition' -l someotheroption
```

and changing it seems like a larger thing and would include more
thrashing.

See #3622.
2019-11-16 14:57:59 +01:00
Fabian Homborg
aae111584d Disable localized number test on OpenBSD
This feature simply does not work there.
2019-11-16 12:11:09 +01:00
Fabian Homborg
c14a7cbc8f seq.fish: Allow "--" separator
This ended up breaking the random test on OpenBSD (apparently the only
place where this is actually used).
2019-11-16 11:21:45 +01:00
ridiculousfish
64ce1088fd Make function_prepare_environment take argv instead of the process
This will help concurrent execution.
2019-11-14 17:58:39 -08:00
Fabian Homborg
7527fc265b psub: Use explicit command
This would have prevented #6323.

While we don't want to pepper `command` everywhere, `psub` is kind of
a core thing, so we should try to proof it against common problems.
2019-11-14 17:13:39 +01:00
ridiculousfish
e18fd3cddb Allow unclosed subshells in interactive mode
If the user has an unclosed subshell in interactive mode, break the
line instead of producing an error.

Fixes #6316
2019-11-13 18:01:47 -08:00
Ankush Patil
ee982c4f6c Fixes #6280 : Added right associativity to 'pow' function 2019-11-13 13:51:01 -08:00
Sergei Morozov
91bda38d57 Added the missing argument for -c|--configuration option of PHPUnit 2019-11-13 13:24:41 -08:00
Sergei Morozov
9251601e0b Added completion of the argument for the composer show command 2019-11-13 13:23:55 -08:00
Sam Yu
4de9a3e102 Update zypper completion
- fix repo completion
- add completion for locale management
2019-11-13 13:20:38 -08:00
ridiculousfish
2c81229ee6 Remove CMake's NDEBUG definition from release builds 2019-11-13 13:13:08 -08:00
Robin Linden
34e06c4440 Remove overrides of default CMake flags
CMake sets these flags to sane defaults depending on which compiler
you're using, so overriding them isn't very nice.

For example:

with g++, I get
-- Debug: -g
-- RelWithDebInfo: -O2 -g -DNDEBUG
-- MinSizeRel: -O2 -g -DNDEBUG
-- Release: -O3 -DNDEBUG

and with MSVC you get something like
-- Debug: /MDd /Zi /Ob0 /Od /RTC1
-- RelWithDebInfo: /MD /Zi /O2 /Ob1 /DNDEBUG
-- MinSizeRel: /MD /Zi /O2 /Ob1 /DNDEBUG
-- Release: /MD /O2 /Ob2 /DNDEBUG
2019-11-13 13:02:05 -08:00
ideal
8aaccf1587 Reduce times of move and copy operation 2019-11-12 14:58:22 -08:00
Johannes Altmanninger
e37bb0721d completions/git: fix typo in deleted-staged files
Fixes #6315
2019-11-12 21:40:13 +01:00
ridiculousfish
ec08a50769 Eliminate function_data_t
This struct is now mostly useless and can go.
2019-11-12 11:25:41 -08:00
ridiculousfish
6d7a66592b Make function_add take the filename directly instead of a parser 2019-11-12 10:00:42 -08:00
ridiculousfish
b51edcfcac Simplify function_info_t and function_data_t
Work towards cleaning up function definition. Migrate inherit_vars into
props and capture their values at the point of definition.
2019-11-12 09:53:10 -08:00
ridiculousfish
b0cf94e3ba Refactor function_prepare_environment
Migrate it into exec.cpp to reduce the complexity of
exec_block_or_func_process.
2019-11-10 14:46:21 -08:00
ridiculousfish
ac2eed2ffa Make io_chain_t store const io_data_t
This will make it easier to reason about with concurrent execution.
2019-11-10 14:00:30 -08:00
ridiculousfish
521d0e84f5 Remove non-const get_io_for_fd
These could be made unused.
2019-11-10 13:41:12 -08:00