From 15c6d8fd4c2f067db1ea324286565b0360c17964 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 10 Dec 2019 20:20:21 +0100 Subject: [PATCH] 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] --- share/completions/pzstd.fish | 10 +--------- share/completions/zstd.fish | 12 ------------ 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/share/completions/pzstd.fish b/share/completions/pzstd.fish index 4c0024f04..ea532a35f 100644 --- a/share/completions/pzstd.fish +++ b/share/completions/pzstd.fish @@ -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" diff --git a/share/completions/zstd.fish b/share/completions/zstd.fish index 69bddcfb6..66944da1a 100644 --- a/share/completions/zstd.fish +++ b/share/completions/zstd.fish @@ -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"