New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lz4 and zstd completions #6364
Add lz4 and zstd completions #6364
Conversation
Squashed commit of the following: commit 08ea083bf87a613675789937d7f6740daa26fc61 Author: Shun Sakai <sorairolake@protonmail.ch> Date: Thu Nov 28 23:51:35 2019 +0900 Implementation of `lz4cat` completions commit 027adedfeb7bb65ffd46e44b4266df3d98368326 Author: Shun Sakai <sorairolake@protonmail.ch> Date: Thu Nov 28 23:36:12 2019 +0900 Implementation of `unlz4` completions commit 522925450a8076d4a0d3377cd9233abc643bbbf7 Author: Shun Sakai <sorairolake@protonmail.ch> Date: Thu Nov 28 23:19:45 2019 +0900 Implementation of `lz4c` completions commit 298ce5e05e3be2cac774063ed2ee8289ba53cf24 Author: Shun Sakai <sorairolake@protonmail.ch> Date: Thu Nov 28 23:02:52 2019 +0900 Implementation of `lz4` completions
Squashed commit of the following: commit 55c8e73faff2418161404f012440acced09580e4 Author: Shun Sakai <sorairolake@protonmail.ch> Date: Fri Nov 29 05:25:02 2019 +0900 Implementation of `zstdless` completions commit e81ae6f83fb9f23bdd6038fbf29ea594da098c2c Author: Shun Sakai <sorairolake@protonmail.ch> Date: Fri Nov 29 05:20:33 2019 +0900 Implementation of `zstdgrep` completions commit 2ade3a9c01bdc5b024f785c369fcb6c3e007cb19 Author: Shun Sakai <sorairolake@protonmail.ch> Date: Fri Nov 29 04:50:42 2019 +0900 Implementation of `pzstd` completions commit 0b9cb86a6936f3de18db7b2c012da6efec89c8e8 Author: Shun Sakai <sorairolake@protonmail.ch> Date: Fri Nov 29 04:39:52 2019 +0900 Implementation of `zstdcat` completions commit e4a4101d18a82fb06ee451560d079b9b81af5f3e Author: Shun Sakai <sorairolake@protonmail.ch> Date: Fri Nov 29 04:25:05 2019 +0900 Implementation of `unzstd` completions commit 88ad0af46d486a92ab3989c55abb3ff477e5a372 Author: Shun Sakai <sorairolake@protonmail.ch> Date: Fri Nov 29 04:18:38 2019 +0900 Implementation of `zstdmt` completions commit 13f2bf7951501031c61a5c0f143b8a29eaa9437e Author: Shun Sakai <sorairolake@protonmail.ch> Date: Fri Nov 29 01:13:52 2019 +0900 Implementation of `zstd` completions
Updated CHANGELOG file. |
share/completions/zstd.fish
Outdated
complete -c zstd -l ultra -d "Enable compression level beyond 19" | ||
complete -c zstd -l long -d "Enable long distance matching with specified windowLog" | ||
|
||
for threads in (seq 0 (count (cat /proc/cpuinfo | string match -r "processor"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could get noisy when running on a machine with many CPUs. Maybe it's better to offer only two options: -T0
to use all available CPUs, and -T#
where the user needs to type the desired number.
I think /proc/cpuinfo
doesn't exist on Mac OS, so this would print an error when loading the completions.
Also nit: string match -r "processor" < /proc/cpuinfo
to get rid of cat
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think /proc/cpuinfo doesn't exist on Mac OS
Also OpenBSD, and FreeBSD by default.
I'd also just drop this, possibly in favor of seq 0 8
(i.e. just "some numbers") and the auto-detection one.
If Python 3.4 or later installed on the system, complement to the number of physical cores. In addition, even if the number of physical cores cannot be obtained, it was fixed to run properly.
Fixed the problem. Probably works on BSD and macOS. |
share/completions/pzstd.fish
Outdated
for threads in (seq 1 (count (cat /proc/cpuinfo | string match -r "processor"))) | ||
complete -x -c pzstd -s p -l processes -a "$threads" -d "De/compress using $threads working threads" | ||
## If Python 3.4 or later installed, the number of physical cores is assigned to a variable. | ||
test -z (__fish_anypython); or set -l physical_cores (eval (__fish_anypython)" -c 'import os; os.cpu_count() is not None and print(os.cpu_count())' ^ /dev/null") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- There's no need for
eval
here, fish since 3.0 allows variables as commands:
set -l python (__fish_anypython)
set -q python[1] and set -l physical_cores ($python -c ...)
- The
^
redirection is deprecated, use2>
instead
Rewrote the code. |
Yup, merged, thanks! |
Description
Added completions for lz4 and zstd.
In commands other than
pzstd
, syntax of options such as-T 4
and--format zstd
does not seem to work. These options work when changed to-T4
and--format=zstd
.TODOs: