Update cmake completion

This commit is contained in:
Shohei YOSHIDA 2022-11-18 22:25:19 +09:00
parent ba6f1e662e
commit df1bba9803
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
1 changed files with 84 additions and 76 deletions

View File

@ -1,6 +1,6 @@
#compdef cmake -value-,CMAKE_GENERATOR,-default- #compdef cmake -value-,CMAKE_GENERATOR,-default-
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Copyright (c) 2017 Github zsh-users - http://github.com/zsh-users # Copyright (c) 2017 Github zsh-users - https://github.com/zsh-users
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -28,7 +28,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for CMake (http://www.cmake.org). # Completion script for CMake 3.25.0 (https://cmake.org).
# #
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Authors # Authors
@ -53,7 +53,7 @@
local context state line curcontext="$curcontext" cmake_args local context state line curcontext="$curcontext" cmake_args
local cmake_build_options;cmake_build_options=( local -a cmake_build_options=(
'-S[Explicitly specify a source directory]:source directory:_path_files -/' '-S[Explicitly specify a source directory]:source directory:_path_files -/'
'-B[Explicitly specify a build directory]:build directory:_path_files -/' '-B[Explicitly specify a build directory]:build directory:_path_files -/'
'-C[Pre-load a script to populate the cache]:initial cache:_files' '-C[Pre-load a script to populate the cache]:initial cache:_files'
@ -62,6 +62,8 @@ local cmake_build_options;cmake_build_options=(
'-G[Specify a makefile generator]:generator:_cmake_generators' '-G[Specify a makefile generator]:generator:_cmake_generators'
'-T[Specify toolset name if supported by generator]:toolset name' '-T[Specify toolset name if supported by generator]:toolset name'
'-A[Specify platform name if supported by generator]:platform name' '-A[Specify platform name if supported by generator]:platform name'
'--toolchain[Specify toolchain file]: :_files'
'--install-prefix[Specify install directory]: :_path_files -/'
# Warnings # Warnings
'(-Wdev)-Wno-dev[Suppress/Enable developer warnings]' '(-Wdev)-Wno-dev[Suppress/Enable developer warnings]'
@ -313,7 +315,7 @@ _cmake_on_install() {
fi fi
} }
local cmake_help_actions;cmake_help_actions=( local -a cmake_help_actions=(
'(- 1)'{--help,-help,-usage,-h,-H}'[Print usage information and exit]' '(- 1)'{--help,-help,-usage,-h,-H}'[Print usage information and exit]'
'(- 1)'{--version,-version}'[Print version number and exit]' '(- 1)'{--version,-version}'[Print version number and exit]'
'(- 1)--help-full[Print all help manuals and exit]' '(- 1)--help-full[Print all help manuals and exit]'
@ -467,8 +469,7 @@ _cmake_define_property_values() {
return ret return ret
} }
local -a _cmake_generator_list local -a _cmake_generator_list=(${(f)"$(cmake --help | awk '/^Generators/{flag=1} flag && /^[* ] [^ ]/ {sub(/^[* ] /, ""); sub(/=.*$/, ""); sub(/\[arch\]/, ""); sub(/ *$/, ""); print}')"})
_cmake_generator_list=(${(f)"$(cmake --help | awk '/^Generators/{flag=1} flag && /^[* ] [^ ]/ {sub(/^[* ] /, ""); sub(/=.*$/, ""); sub(/\[arch\]/, ""); sub(/ *$/, ""); print}')"})
# ----------------- # -----------------
# _cmake_generators # _cmake_generators
@ -486,7 +487,6 @@ _cmake_toolchain_files() {
_files -g '*\.cmake*' _files -g '*\.cmake*'
} }
local _cmake_booleans=(_describe -t booleans 'boolean' 'YES' 'NO') local _cmake_booleans=(_describe -t booleans 'boolean' 'YES' 'NO')
# --------------- # ---------------
@ -510,7 +510,7 @@ _cmake_launchers() {
_command_names -e _command_names -e
} }
local _cmake_commands=( local -a _cmake_commands=(
'capabilities:Report capabilities built into cmake in JSON format' \ 'capabilities:Report capabilities built into cmake in JSON format' \
'cat:concat the files and print them to the standard output' \ 'cat:concat the files and print them to the standard output' \
'chdir:run command in a given directory' \ 'chdir:run command in a given directory' \
@ -582,3 +582,11 @@ elif [[ $words[2] == -E ]]; then
else else
_arguments "$cmake_build_options[@]" _arguments "$cmake_build_options[@]"
fi fi
# 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