completions/zstd: Remove code to figure out number of CPUs

This purported to need python > 3.4, but used anypython.

Plus it's not super useful anyway since it can easily be told to
use *all* cpus, so there's no need to set it to the precise number.

See #6400.

[ci skip]
This commit is contained in:
Fabian Homborg 2019-12-10 20:20:21 +01:00
parent ea7868988a
commit 15c6d8fd4c
2 changed files with 1 additions and 21 deletions

View File

@ -14,15 +14,7 @@ end
complete -c pzstd -l ultra -d "Enable compression level beyond 19"
## If Python 3.4 or later installed, the number of physical cores is assigned to a variable.
set -l python (__fish_anypython)
set -q python[1]; and set -l physical_cores ($python -c 'import os; os.cpu_count() is not None and print(os.cpu_count())' 2> /dev/null)
if set -q physical_cores; and test -n "$physical_cores"
complete -x -c pzstd -s p -l processes -a "(seq 1 $physical_cores)" -d "De/compress using $threads working threads"
else
complete -x -c pzstd -s p -l processes -a NUM -d "De/compress using NUM working threads"
end
complete -x -c pzstd -s p -l processes -a "(seq 1 8)" -d "De/compress using NUM working threads"
complete -r -c pzstd -s o -d "Specify file to save"
complete -c pzstd -s f -l force -d "Overwrite without prompting"

View File

@ -19,20 +19,8 @@ complete -c zstd -l fast -d "Ultra-fast compression"
complete -c zstd -l ultra -d "Enable compression level beyond 19"
complete -c zstd -l long -d "Enable long distance matching with specified windowLog"
## If Python 3.4 or later installed, the number of physical cores is assigned to a variable.
set -l python (__fish_anypython)
set -q python[1]; and set -l physical_cores ($python -c 'import os; os.cpu_count() is not None and print(os.cpu_count())' 2> /dev/null)
## When using all physical cores.
complete -c zstd -o T0 -l threads=0 -d "Compress using as many threads as there are CPU cores on the system"
if set -q physical_cores; and test -n "$physical_cores"
for threads in (seq 1 $physical_cores)
complete -c zstd -o T"$threads" -l threads="$threads" -d "Compress using $threads working threads"
end
else
complete -c zstd -o TNUM -l threads=NUM -d "Compress using NUM working threads"
end
complete -c zstd -l single-thread -d "Single-thread mode"
complete -c zstd -l adapt -d "Dynamically adapt compression level to I/O conditions"
complete -c zstd -l stream-size -d "Optimize compression parameters for streaming input of specified bytes"