-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Long flags for sudo (e.g. --askpass
or --preserve-env
) are treated as commands, and highlighted for not existing. The plugin also seems to assume sudo [flags] [env] [command] [args...]
order, but flags and env can be mixed. (e.g. in sudo -s foo=bar baz
, it recogdies -s
as a flag, foo=bar
as an environment variable, and baz
as a command. but in sudo foo=bar -s baz
, foo=bar
is recognised as env, -s
as a command, and baz
as an argument)
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
danielshahaf commentedon Nov 10, 2019
This is a multi-pronged issue; let me break it down.
--foo
flags that don't take an arguments: Easy.--foo=bar
flags that take an argument in the same word: Easy.--foo bar
flags that take an argument in the next word: Would require hardcoding the list of such options, as we already do for one-letter options.Status: not urgent, since there's a workaround: using the
--foo=bar
syntax.--
end-of-options marker: Easy.Status: That's main: Do not highlight options after -- #502
This is a bug. The assignment is highlighted here for the same reason it's highlighted in
% LC_ALL=C ls
, but the code is generic and most precommands don't allow assignments here;sudo
andenv
are exceptions. So:nice x=y ls
: Should beunknown-token
. Easy to support with a little state machine work.sudo -s foo=bar ls
,env x=y ls
: Currently work. Are exceptions to the case in the previous bullet.sudo foo=bar -s ls
: Could be supported, but it's unique tosudo
.danielshahaf commentedon Nov 10, 2019
Tentatively setting milestone to 0.8.0, but it's not a release blocker.
tests: Skip cardinality tests whenever any test point is expected to …
Add a test for issue zsh-users#641.5, using the infrastructure added …
danielshahaf commentedon Jan 11, 2020
#658 proposes changing the behaviour so the flags would be highlighted as ordinary double-quoted options (default: no highlighting) rather than an error. (Yes, I should perhaps have thought of that sooner.)
'main': Add an XFail test for zsh-users#641 and zsh-users#658.
'main': Don't highlight unknown precommand flags as errors.
'main': Don't highlight unknown precommand flags as errors.
danielshahaf commentedon Jan 12, 2020
Changing the error highlighting to no highlighting (as it was in 0.6.0) is tracked under #658/#664 and is milestoned for 0.7.0. The remainder is new features and not particularly urgent so I'm unscheduling them. (Would be nice to hook into the completion system and solve the long options support this way...)
'main': Add an XFail test for #641 and #658.
'main': Don't highlight unknown precommand flags as errors.
Merge remote-tracking branch 'danielsh/tests-skip-cardinality-v1'
danielshahaf commentedon Mar 19, 2020
Cross-referencing #608 for #641.5, #641.6, #641.7.