zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] avoid localized output from external commands in a few completion
@ 2017-12-25 23:40 Jun T.
  2017-12-26  1:04 ` Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: Jun T. @ 2017-12-25 23:40 UTC (permalink / raw)
  To: zsh-workers

In some recent Linux distributions, output from commands
like 'nm --help' is localized and can't be analyzed correctly
by completion scripts. We need to reset LC_MESSAGES.


diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk
index f37305445..f6bf9250d 100644
--- a/Completion/Linux/Command/_lsblk
+++ b/Completion/Linux/Command/_lsblk
@@ -44,7 +44,7 @@ case $state in
   ;|
   column*)
     values=(
-      ${${${${(f)"$(_call_program columns lsblk -h)"}[(r)Available*,-3]## #}[2,-1]//:/\\:}/  /:}
+      ${${${${(f)"$(_call_program columns LC_MESSAGES=C lsblk -h)"}[(r)Available*,-3]## #}[2,-1]//:/\\:}/  /:}
     )
     _describe -t fields column values -M 'm:{a-z}={A-Z}' $suf -F dedup && ret=0
   ;;
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index 146a69e8a..b195a66ef 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -64,7 +64,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
 	'--plugin[load specified plugin]:plugin'
 	'--special-syms[include special symbols in the output]'
 	'--synthetic[display synthetic symbols as well]'
-	"--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })"
+	"--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets LC_MESSAGES=C nm --help)}:#*supported targets:*}##*: })"
 	'--with-symbol-versions[display version strings after symbol names]'
       )
     ;;
diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump
index e012b4cbc..9744d3177 100644
--- a/Completion/Unix/Command/_objdump
+++ b/Completion/Unix/Command/_objdump
@@ -92,13 +92,13 @@ case "$state" in
     _values -s , "dwarf section" rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index
   ;;
   bfdname)
-    _values "object format" "${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported targets:*}##*: }"
+    _values "object format" "${(z)${(@M)${(f)$(_call_program targets LC_MESSAGES=C objdump --help)}##* supported targets:*}##*: }"
   ;;
   machine)
-    _values "machine architecture" "${(@)${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported architectures:*}##*: }//:/\\:}"
+    _values "machine architecture" "${(@)${(z)${(@M)${(f)$(_call_program targets LC_MESSAGES=C objdump --help)}##* supported architectures:*}##*: }//:/\\:}"
   ;;
   disassembler_options)
-    _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:#  [^ ]*}#  }%% *}"
+    _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets LC_MESSAGES=C objdump --help)}[2]}:#  [^ ]*}#  }%% *}"
   ;;
 esac
 
diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip
index 0703c50e4..552c2839c 100644
--- a/Completion/Unix/Command/_strip
+++ b/Completion/Unix/Command/_strip
@@ -54,7 +54,7 @@ case $state in
     local expl
     declare -a bfdnames
 
-    bfdnames=(${=${(M)${(f)"$(_call_program bfdnames strip --help)"}:#strip: supported targets: *}#strip: supported targets: })
+    bfdnames=(${=${(M)${(f)"$(_call_program bfdnames LC_MESSAGES=C strip --help)"}:#strip: supported targets: *}#strip: supported targets: })
     _describe -t bfdnames 'bfd name' bfdnames && ret=0
     ;;
 esac



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-12-28  2:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-25 23:40 [PATCH] avoid localized output from external commands in a few completion Jun T.
2017-12-26  1:04 ` Bart Schaefer
2017-12-26  1:19   ` Daniel Shahaf
2017-12-26  4:47     ` Jun T
2017-12-26  4:59       ` Jun T
2017-12-26 10:52         ` Jun T
2017-12-27 11:51           ` Jun T
2017-12-27 23:15             ` Daniel Shahaf
2017-12-28  2:54               ` Jun T
2017-12-26  5:24       ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).