2018-01-07 13:34:04 -08:00
|
|
|
// Define ELEM before including this file.
|
|
|
|
|
ELEM(job_list)
|
|
|
|
|
ELEM(job)
|
2018-03-02 18:09:16 -08:00
|
|
|
ELEM(job_decorator)
|
2018-03-01 13:39:39 -08:00
|
|
|
ELEM(job_conjunction)
|
2018-03-01 18:30:48 -08:00
|
|
|
ELEM(job_conjunction_continuation)
|
2018-01-07 13:34:04 -08:00
|
|
|
ELEM(job_continuation)
|
|
|
|
|
ELEM(statement)
|
|
|
|
|
ELEM(if_statement)
|
|
|
|
|
ELEM(if_clause)
|
|
|
|
|
ELEM(else_clause)
|
|
|
|
|
ELEM(else_continuation)
|
|
|
|
|
ELEM(switch_statement)
|
|
|
|
|
ELEM(case_item_list)
|
|
|
|
|
ELEM(case_item)
|
|
|
|
|
ELEM(block_statement)
|
|
|
|
|
ELEM(block_header)
|
|
|
|
|
ELEM(for_header)
|
|
|
|
|
ELEM(while_header)
|
|
|
|
|
ELEM(begin_header)
|
|
|
|
|
ELEM(function_header)
|
2018-03-02 18:09:16 -08:00
|
|
|
ELEM(not_statement)
|
2018-01-07 13:34:04 -08:00
|
|
|
ELEM(andor_job_list)
|
|
|
|
|
ELEM(decorated_statement)
|
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-10-23 03:13:29 +02:00
|
|
|
ELEM(variable_assignment)
|
|
|
|
|
ELEM(variable_assignments)
|
2018-01-07 13:34:04 -08:00
|
|
|
ELEM(plain_statement)
|
|
|
|
|
ELEM(argument_list)
|
|
|
|
|
ELEM(arguments_or_redirections_list)
|
|
|
|
|
ELEM(argument)
|
|
|
|
|
ELEM(redirection)
|
|
|
|
|
ELEM(optional_background)
|
2018-02-18 14:37:44 -08:00
|
|
|
ELEM(optional_newlines)
|
2019-12-21 11:45:07 +01:00
|
|
|
ELEM(optional_time)
|
2018-01-07 13:34:04 -08:00
|
|
|
ELEM(end_command)
|
|
|
|
|
ELEM(freestanding_argument_list)
|
|
|
|
|
#undef ELEM
|
|
|
|
|
|