From 667494f3346d91b187f286fc6e992e888913bd16 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Sun, 26 Oct 2025 16:26:30 +0900 Subject: [PATCH] add lsmem completion --- src/_lsmem | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/_lsmem diff --git a/src/_lsmem b/src/_lsmem new file mode 100644 index 0000000..d5bcf01 --- /dev/null +++ b/src/_lsmem @@ -0,0 +1,73 @@ +#compdef lsmem +# ------------------------------------------------------------------------------ +# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for lsmem v2.41 (https://github.com/util-linux/util-linux) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Shohei Yoshida (https://github.com/syohex) +# +# ------------------------------------------------------------------------------ + +(( $+functions[_lsmem_output_columns] )) || +_lsmem_output_columns() { + local -a columns=( + "RANGE[start and end address of the memory range]" + "SIZE[size of the memory range]" + "STATE[online status of the memory range]" + "REMOVABLE[memory is removable]" + "BLOCK[memory block number or blocks range]" + "NODE[numa node of memory]" + "ZONES[valid zones for the memory range]" + ) + + _values -s ',' column $columns +} + +_arguments \ + '(- *)'{-h,--help}'[display this help]' \ + '(- *)'{-V,--version}'[display version]' \ + '(-J --json)'{-J,--json}'[use the JSON output format]' \ + '(-P --pairs)'{-P,--pairs}'[use key=value output format]' \ + '(-a --all)'{-a,--all}'[list each individual memory block]' \ + '(-b --bytes)'{-b,--bytes}'[print SIZE in bytes rather]' \ + '(-n --noheadings)'{-n,--noheadings}'[do not print headings]' \ + '(-o --output)'{-o,--output=-}'[output columns]:columns:_lsmem_output_columns' \ + '(-o --output --output-all)--output-all[output all columns]' \ + '(-r --raw)'{-r,--raw}'[use the raw output format]' \ + '(-S --split)'{-S,--split}'[split ranges by specified columns]:columns:_lsmem_output_columns' \ + '(-s --sysroot)'{-s,--sysroot}'[use the specified directory as system root]:dir:_files -/' \ + '--summary=-[print summary information]:when:(never always only)' + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et