ridiculousfish
db98ee13a9
Make complete() return the completion list directly
...
Returning it through a pointer was a remnant of pre C++-11 days.
2020-01-16 15:18:50 -08:00
ridiculousfish
4bb18eaf42
Use completion_list_t naming everywhere
...
std::vector<completion_t> -> completion_list_t
2020-01-16 15:18:49 -08:00
ridiculousfish
f1ce967dfa
Do not allow empty items to be added to history
...
Empty items are used as sentinels to indicate that we've reached the end of
history, so they should not be added as actual items. Enforce this.
Fixes #6032
2020-01-05 12:47:02 -08:00
ridiculousfish
89880891d0
Revert "fish_tests to set HOME and other variables to temporary dir"
...
This reverts commit cca57a7a87
.
The tests target already sets some variables - backing this out.
2020-01-01 17:24:14 -08:00
ridiculousfish
cca57a7a87
fish_tests to set HOME and other variables to temporary dir
...
Rather than placing files in the user's home directory, have fish_tests
manipulate HOME to be a temporary directory.
2020-01-01 16:34:56 -08:00
ridiculousfish
b784a0caa3
dup2_list_t::resolve_chain to stop returning maybe
...
It can no longer fail.
2019-12-29 14:49:05 -08:00
Mathieu Duponchelle
15c1b3ed4b
Place fish in its own process group when launched with -i
...
Fixes #5909
2019-12-23 10:32:37 +01:00
ridiculousfish
c19407ab0f
Default parser_t::eval()'s block type to top
...
This is the parameter value at every call site except one. Just make it the
default.
2019-12-22 16:27:03 -08:00
ridiculousfish
a59f35a378
Make block_type_t an enum class
2019-12-22 15:37:14 -08:00
ridiculousfish
0531c02ce4
Remove 'user_supplied' flag for io_fd_t
...
user_supplied was used to distinguish IO redirections which were
explicit, vs those that came about through "transmogrphication." But
transmogrification is no more. Remove the flag.
2019-12-19 14:14:23 -08:00
ridiculousfish
311f47d683
Remove an errant fprintf from the tests
2019-12-17 18:26:57 -08:00
ridiculousfish
b3d2cdc0ff
Unify parse_execution_result_t and eval_result_t again
...
Do other cleanup to better express the difference between cancellation
and control flow.
2019-12-17 18:12:49 -08:00
ridiculousfish
72de8768d9
Remove RUNNING_IN_XCODE checks
...
This is never set any more.
2019-12-17 16:19:12 -08:00
ridiculousfish
09f8e05b80
Clean up the return type of parser_t::eval
...
parser_t::eval indicates whether there was a parse error. It can be
easily confused with the status of the execution. Use a real type to
make it more clear.
2019-12-17 16:16:43 -08:00
ridiculousfish
8bf9f52461
Always detach new pthreads
...
There are no longer any calls to pthread_join. Just make all pthreads
detached.
2019-12-16 14:08:46 -08:00
ridiculousfish
33aff87c10
Switch io_file_t to store an fd, not a path
...
Prior to this fix, a file redirection was turned into an io_file_t. This is
annoying because every place where we want to apply the redirection, we
might fail due to open() failing. Switch to opening the file at the point
we resolve the redirection spec. This will simplify a lot of code.
2019-12-12 17:34:40 -08:00
ridiculousfish
be685faeb8
Clean up how pipe fd avoidance works
...
fish has to ensure that the pipes it creates do not conflict with any
explicit fds named in redirections. Switch this code to using
autoclose_fd_t to make the ownership logic more explicit, and also
introduce fd_set_t to reduce the dependence on io_chain_t.
2019-12-12 14:58:18 -08: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
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
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
896ef65f8c
Rename error_offset to error_offset_within_token
...
Hopefully clarify the role of this variable.
2019-11-08 16:56:50 -08:00
ridiculousfish
ef8b5e4fa0
Correct certain tokenizer error reporting for unclosed subshells
...
There was some confusion about the different pointers and offsets
in tokenizer_t::call_error.
Fixes #6281
2019-11-08 16:56:43 -08:00
Johannes Altmanninger
e94b9ccf3e
Do import bash history commands containing && or ||
2019-11-07 23:33:35 +01:00
ridiculousfish
52e900690b
Make history_search_type_t an enum class
2019-11-02 18:56:16 -07:00
ridiculousfish
eeac3333df
Correctly highlight input following a tokenizer error
2019-10-27 16:08:49 -07:00
ridiculousfish
afd20b8e1a
Correctly report the range of tokenizer errors
...
This enables proper syntax highlighting of tokenizer errors.
2019-10-27 16:05:37 -07:00
ridiculousfish
2a92e66902
Support for &> and &| as convenience redirections
...
This adds support for &> and &| syntax, which both redirect stdout, and
also apply a redirection of stderr to stdout.
2019-10-27 15:24:57 -07:00
LawAbidingCactus
305a657694
fix typos
2019-10-23 19:38:44 +02:00
ridiculousfish
35671dd9f0
Clean up and unify pipes and redirections
...
This cleans up how pipes and redirections are recognized by the parser,
and unifies pipes and redirections into a single type.
2019-10-15 11:26:41 -07:00
ridiculousfish
1a65e18ba8
Clean up some tokenization
...
Remove TOK_NONE
Turn token_type into an enum class
Make next() turn a maybe_t<tok_t> instead of a bool
2019-10-13 16:06:16 -07:00
ridiculousfish
82eca4bc86
Run clang-format on all files
...
The main change here is to reorder headers.
2019-10-13 15:50:48 -07:00
ridiculousfish
a19d9b2e73
Add a test for #6130
2019-09-22 14:06:38 -07:00
Johannes Altmanninger
8baea8b157
Do not add a space after completion if one is already there
...
Example: type `cd --help --help`, move the cursor inside the first `--help` and press tab.
This used to add redundant spaces.
2019-09-18 14:02:24 -05:00
ridiculousfish
535a448d0e
Remove an errant fprintf
2019-09-08 15:44:07 -07:00
ridiculousfish
b2fe2f9ff3
Correct escaping and add tests for bracket completion
...
Add some tests for new bracket completion behavior, and fix an escaping
bug where \\[ was incorrectly marked as escaping.
2019-09-08 15:43:20 -07:00
ridiculousfish
0dc5eaeb97
reader_expand_abbreviation_in_command to return maybe_t<wcstring>
2019-08-06 16:09:23 -07:00
ridiculousfish
822b53c67a
Don't color a whole string invalid because of an unclosed quote
...
When syntax highlighting a quoted string, if the string is not closed,
only show the opening quote as an error, not the whole string.
2019-07-24 12:43:47 -07:00
ridiculousfish
8ec568d21f
Add some tests to path_apply_working_directory
2019-07-15 17:56:06 -07:00
ridiculousfish
0e4fe53718
clang-format some files
2019-07-06 13:11:50 -07:00
ridiculousfish
bc0329f775
Add wcstolower
...
Converts a string to lowercase. Eliminates some loops that did this
explicitly.
2019-07-06 12:19:34 -07:00
ridiculousfish
4a2c709fb1
Eliminate shell_is_interactive
...
We used to have a global notion of "is the shell interactive" but soon we
will want to have multiple independent execution threads, only some of
which may be interactive. Start tracking this data per-parser.
2019-06-29 11:28:26 -07:00
Fabian Homborg
caedf01c00
Revert "Latch signal handlers"
...
This reverts commit 7ed1022cf4
.
Fixes #5962 .
2019-06-25 11:25:09 +02:00
ridiculousfish
be97499106
Revert "Revert "Add a test for autoload_t""
...
This reverts commit 2507162f80
.
Put back the autoload test.
2019-06-07 12:12:43 -07:00
ridiculousfish
fc99d6c7af
clang-format all files
2019-06-03 20:30:48 -07:00
ridiculousfish
890c1188ab
Instantize and rationalize locking around the input mapping set
...
Hypothetically a background thread could invoke builtin_bind, etc.
Protect the set of input bindings with a lock.
2019-06-02 22:54:01 -07:00
ridiculousfish
671df14178
Thread a parser into inputter_t
2019-06-02 16:41:13 -07:00
ridiculousfish
a48dbf23b8
Instantize the character event queue
...
Wrap this stuff up in structs so it's no longer global.
2019-06-02 16:37:05 -07:00
Fabian Homborg
61292b0c6c
fish_tests: Fix warnings
2019-05-29 21:11:08 +02:00
David Adam
c848787107
add extra test for wcsfilecmp
...
Test changes added for #5634 in 6e525cc5d9
.
2019-05-28 22:03:03 +08:00