Skip to content

Commit

Permalink
fix(ps,ss): avoid extra expansions by -W "$(...)" in _comp_delimited
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed May 28, 2023
1 parent 49997d0 commit cb347cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion completions/ps
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ _comp_cmd_ps()
--format | ?(-)[Oo] | [^-]*[Oo])
# TODO: This doesn't work well when there are multiple options for
# the non-first item (similarly to useradd --groups and others).
_comp_delimited , -W "$("$1" L | awk '{ print $1 }')"
local labels=$("$1" L | awk '{ print $1 }')
_comp_delimited , -W '$labels'
return
;;
esac
Expand Down
5 changes: 3 additions & 2 deletions completions/ss
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ _comp_cmd_ss()
return
;;
--query | -${noargopts}A)
_comp_delimited , -W "$("$1" --help |
command sed -e 's/|/ /g' -ne 's/.*QUERY := {\([^}]*\)}.*/\1/p')"
local queries=$("$1" --help |
command sed -e 's/|/ /g' -ne 's/.*QUERY := {\([^}]*\)}.*/\1/p')
_comp_delimited , -W '$queries'
return
;;
--diag | --filter | -${noargopts}[DF])
Expand Down

0 comments on commit cb347cb

Please sign in to comment.