Skip to content

refactor: simplify sed/awk/grep uses, etc.#1574

Open
akinomyoga wants to merge 6 commits intoscop:mainfrom
akinomyoga:sed-6
Open

refactor: simplify sed/awk/grep uses, etc.#1574
akinomyoga wants to merge 6 commits intoscop:mainfrom
akinomyoga:sed-6

Conversation

@akinomyoga
Copy link
Collaborator

No description provided.

The variable "prefix" is explicitly initialized when it is declared,
so we do not need to explicitly set it to an empty string on this
line.
The current implementation does not work for several reasons.

* First, for the selection "|" to work, one needs to enclose the
  entire pattern with "@()". The option argument of the "-X" option is
  not a regular expression, but an extended glob pattern.
* Next, the option argument of the "-X" option should not be singly
  quoted in the present case because command substitutions in the
  option argument of "-X" is not going to be expanded.
* Also, one also wants to quote the word of the here string.  In Bash
  < 4.4, the word of the here string is subject to word splitting, so
  it may be affected by IFS.

In addition, we actually do not need to use the "tr" command.  We can
reduce the spawn cost by using "${words[*]}" with an appropriate value
of IFS.
"_comp_cmd_tshark__{prefs,protocols}" are mutable global variables
used to cache the prefixes and protocols, so they should have "_mut_"
in the variable names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant