From e4006dea723488abbd4955dc9c610bfeaa26a54a Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 19 Mar 2026 18:40:37 +0900 Subject: [PATCH 1/3] add ctest --- src/_ctest | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 src/_ctest diff --git a/src/_ctest b/src/_ctest new file mode 100644 index 0000000..91d5313 --- /dev/null +++ b/src/_ctest @@ -0,0 +1,179 @@ +#compdef ctest +# ------------------------------------------------------------------------------ +# Copyright (c) 2026 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 ctest 4.3.0 (https://kitware.com/cmake) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Shohei Yoshida (https://github.com/syohex) +# +# ------------------------------------------------------------------------------ + +_ctest() { + local ret=1 + + _arguments \ + '--preset=[Read arguments from a test preset]:preset' \ + '--list-presets[List available test presets]' \ + '(-C --build-config)'{-C,--build-config}'[Choose configuration to test]:config' \ + '--progress[Enable short progress output from tests]' \ + '(-V --verbose -VV --extra-verbose)'{-V,--verbose}'[Enable verbose output from tests]' \ + '(-V --verbose -VV --extra-verbose)'{-VV,--extra-verbose}'[Enable more verbose output from tests]' \ + '--debug[Displaying more verbose internals of CTest]' \ + '--output-on-failure[Output anything outputted by the test program if the test should fail]' \ + '--stop-on-failure[Stop running the tests after one has failed]' \ + '--test-output-size-passed[Limit the output for passed tests to bytes]:size' \ + '--test-output-size-failed[Limit the output for failed tests to bytes]:size' \ + '--test-output-truncation[Truncate mode]:mode:(tail middle head)' \ + '-F[Enable failover]' \ + '(-j --parallel)'{-j,--parallel}'[Run tests in parallel]::level' \ + '(-Q --quiet)'{-Q,--quiet}'[Make ctest quiet]' \ + '(-O --output-log)'{-O,--output-log}'[Output to log file]:file:_files' \ + '--output-junit[Output test results to JUnit XML file]:file:_files' \ + '(-N --show-only)'{-N,--show-only}'[Disable actual execution of tests]::format:(format human json-v1)' \ + \*{-L,--label-regex}'[Run tests with labels matching regular expression]:regex' \ + \*{-R,--tests-regex}'[Run tests matching regular expression]:regex' \ + \*{-E,--exclude-regex}'[Exclude tests matching regular expression]:regex' \ + \*{-LE,--label-exclude}'[Exclude tests with labels matching regular expression]:regex' \ + \*{-FA,--fixture-exclude-any}'[Do not automatically add any tests for fixtures matching regular expression]:regex' \ + \*{-FS,--fixture-exclude-setup}'[Do not automatically add setup tests for fixtures matching regular expression]:regex' \ + \*{-FC,--fixture-exclude-cleanup}'[Do not automatically add cleanup tests for fixtures matching regular expression]:regex' \ + '(--dashboard)'{-D,--dashboard}'[Execute dashboard test]:dashboard' \ + *'-D[Define a variable for script mode]:var' \ + '(-M --test-model)'{-M,--test-model}'[Set the model for a dashboard]:model' \ + '(-T --test-action)'{-T,--test-action}'[Set the dashboard action to perform]' \ + '--group[Specify what build group on the dashboard]:group' \ + \*{-S,--script,-Sp,--script-new-process}'[Execute a dashboard for a configuration]:script:_files' \ + '(-A --add-notes)'{-A,--add-notes}'[Add a notes file with submission]:file:_files' \ + '(-I --test-information)'{-I,--test-information}'[Run a specific number of tests by number]:number' \ + '(-U --union)'{-U,--union}'[Take the Union of -I and -R]' \ + '--rerun-failed[Run only the tests that failed previously]' \ + '--tests-from-file[Run the tests listed in the given file]:file:_files' \ + '--exclude-from-file[Run tests except those listed in the given file]:file:_files' \ + '--repeat-until-fail[Repeat each test to run times without failing]:n' \ + '--repeat[Repeat each test to run times]:condition-n:(until-fail: until-pass: after-timeout:)' \ + '--max-width[Set the max width for a test name to output]' \ + '--interactive-debug-mode[Set the interactive mode to 0 or 1]:n:(0 1)' \ + '--resource-spec-file[Set the resource spec file to use]:file:_files' \ + '--no-label-summary[Disable timing summary information for labels]' \ + '--no-subproject-summary[Disable timing summary information for subprojects]' \ + '--test-dir[Specify the directory in which to look for tests]:dir:_files -/' \ + '--build-and-test[Configure, build and run a test]' \ + *'--build-target[Specify a specific target to build]:target' \ + '--build-nocmake[Run the build without running cmake first]' \ + '--build-run-dir[Specify directory to run programs from]:dir:_files -/' \ + '--build-two-config[Run CMake twice]' \ + '--build-exe-dir[Specify the directory for the executable]:dir:_files -/' \ + '--build-generator[Specify the generator to use]:generator' \ + '--build-generator-platform[Specify the generator-specific platform]:generator_platform' \ + '--build-generator-toolset[Specify the generator-specific toolset]:build_toolset' \ + '--build-project[Specify the name of the project to build]:project' \ + '--build-makeprogram[Specify the make program to use]:make:_files' \ + '--build-noclean[Skip the make clean step]' \ + '--build-config-sample[A sample executable to use to determine the configuration]:sample' \ + *'--build-options[Add extra options to the build step]' \ + '--test-command[The test to run with the --build-and-test-option]:command' \ + '--test-timeout[The time limit in seconds]:timeout' \ + '--test-load[CPU load threshold for starting new parallel tests]:threshold' \ + '--tomorrow-tag[starts with next day tag]' \ + '--overwrite[Overwrite CTest configuration option]' \ + '--extra-submit[Submit extra files to the dashboard]:file:_files' \ + *'--http-header[Append HTTP header when submitting]:header' \ + '--schedule-random[Use a random order for scheduling tests]' \ + '--schedule-random-seed[Override seed for random order of tests]:seed' \ + '--submit-index[Submit individual dashboard tests with specific index]:index' \ + '--timeout[Set the default test timeout]:timeout' \ + '--stop-time[Set a time at which all tests should stop running]:time' \ + '--http1.0[Submit using HTTP 1.0]' \ + '--no-compress-output[Do not compress test output when submitting]' \ + '--print-labels[Print all available test labels]' \ + '--no-tests=[Regard no tests]:type:(error ignore)' \ + '(- *)'{--help,-help,-usage,-h,-H}'[Print usage information and exit]' \ + '(- *)'{--version,-version}'[Print version number and exit]' \ + '(- *)--help-full[Print all help manuals and exit]' \ + '(- *)--help-manual[Print one help manual and exit]:manual:_ctest_help_manuals' \ + '(- *)--help-manual-list[List help manuals available and exit]' \ + '(- *)--help-command[Print help for one command and exit]:command:_ctest_help_commands' \ + '(- *)--help-command-list[List commands with help available and exit]' \ + '(- *)--help-commands[Print cmake-commands manual and exit]' \ + '(- *)--help-module[Print help for one module and exit]:module:_ctest_help_modules' \ + '(- *)--help-module-list[List modules with help available and exit]' \ + '(- *)--help-modules[Print cmake-modules manual and exit]' \ + '(- *)--help-policy[Print help for one policy and exit]:policy:_ctest_help_policies' \ + '(- *)--help-policy-list[List policies with help available and exit]' \ + '(- *)--help-policies[Print cmake-policies manual and exit]' \ + '(- *)--help-property[Print help for one property and exit]:property:_ctest_help_properties' \ + '(- *)--help-property-list[List properties with help available and exit]' \ + '(- *)--help-properties[Print cmake-properties manual and exit]' \ + '(- *)--help-variable[Print help for one variable and exit]:variable:_ctest_help_variables' \ + '(- *)--help-variable-list[List variables with help available and exit]' \ + '(- *)--help-variables[Print cmake-variables manual and exit]' \ + && ret=0 + + return ret +} + +_ctest_help_manuals() { + local -a manuals=(${(f)"$(ctest --help-manual-list 2>/dev/null | sed 's/([0-9]\+)$//' )"}) + _values 'manual' $manuals +} + +_ctest_help_commands() { + local -a commands=(${(f)"$(ctest --help-command-list 2>/dev/null )"}) + _values 'command' $commands +} + +_ctest_help_modules() { + local -a modules=(${(f)"$(ctest --help-module-list 2>/dev/null )"}) + _values 'module' $modules +} + +_ctest_help_policies() { + local -a policies=(${(f)"$(ctest --help-policy-list 2>/dev/null )"}) + _values 'policy' $policies +} + +_ctest_help_properties() { + local -a properties=(${(f)"$(ctest --help-property-list 2>/dev/null )"}) + _values 'property' $properties +} + +_ctest_help_variables() { + local -a variables=(${(f)"$(ctest --help-variable-list 2>/dev/null )"}) + _values 'variable' $variables +} + +_ctest "$@" + +# 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 From 5993fc38e7218efd158023465ce0722a7fc16a46 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Sat, 21 Mar 2026 23:00:53 +0900 Subject: [PATCH 2/3] Add cpack completion --- src/_cpack | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 src/_cpack diff --git a/src/_cpack b/src/_cpack new file mode 100644 index 0000000..6619e18 --- /dev/null +++ b/src/_cpack @@ -0,0 +1,156 @@ +#compdef cpack +# ------------------------------------------------------------------------------ +# Copyright (c) 2026 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 cpack 4.3.0 (https://kitware.com/cmake) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Shohei Yoshida (https://github.com/syohex) +# +# ------------------------------------------------------------------------------ + +_cpack() { + local ret=1 + + _arguments \ + '-G[Override/define CPACK_GENERATOR]:generator:_cpack_generators' \ + '-C[Specify the project configurations]:configuration:(Debug Release)' \ + *'-D[Set a CPack variable]:var_val' \ + '--config[Specify the config file]:file:_files' \ + '(-V --verbose)'{-V,--verbose}'[Enable verbose output]' \ + '--trace[Put underlying cmake scripts in trace mode]' \ + '--trace-expand[Put underlying cmake scripts in expanded trace mode]' \ + '--debug[Enable debug output]' \ + '-P[Override/define CPACK_PACKAGE_NAME]:package_name' \ + '-R[Override/define CPACK_PACKAGE_VERSION]:package_version' \ + '-B[Override/define CPACK_PACKAGE_DIRECTORY]:package_directory:_files -/' \ + '--vendor[Override/define CPACK_PACKAGE_VENDOR]:vendor' \ + '--preset[Read arguments from a package preset]' \ + '--list-presets[List available package preset]' \ + '(- *)'{--version,-version}=-'[Print version number and exit]::format:(json-v1)' \ + '(- *)--help[Print usage information and exit]' \ + '(- *)--help-full[Print all help manuals and exit]' \ + '(- *)--help-manual[Print one help manual and exit]:manual:_cpack_help_manuals' \ + '(- *)--help-manual-list[List help manuals available and exit]' \ + '(- *)--help-command[Print help for one command and exit]:command:_cpack_help_commands' \ + '(- *)--help-command-list[List commands with help available and exit]' \ + '(- *)--help-commands[Print cmake-commands manual and exit]' \ + '(- *)--help-module[Print help for one module and exit]:module:_cpack_help_modules' \ + '(- *)--help-module-list[List modules with help available and exit]' \ + '(- *)--help-modules[Print cmake-modules manual and exit]' \ + '(- *)--help-policy[Print help for one policy and exit]:policy:_cpack_help_policies' \ + '(- *)--help-policy-list[List policies with help available and exit]' \ + '(- *)--help-policies[Print cmake-policies manual and exit]' \ + '(- *)--help-property[Print help for one property and exit]:property:_cpack_help_properties' \ + '(- *)--help-property-list[List properties with help available and exit]' \ + '(- *)--help-properties[Print cmake-properties manual and exit]' \ + '(- *)--help-variable[Print help for one variable and exit]:variable:_cpack_help_variables' \ + '(- *)--help-variable-list[List variables with help available and exit]' \ + '(- *)--help-variables[Print cmake-variables manual and exit]' \ + && ret=0 + + return ret +} + +_cpack_generators() { + local -a generators=( + "7Z:[7-Zip file format with default compression algorithm]" + "7Z_BZ2:[7-Zip file format with BZip2 compression]" + "7Z_DEFLATE:[7-Zip file format with Deflate compression]" + "7Z_LZMA:[7-Zip file format with LZMA compression]" + "7Z_LZMA2:[7-Zip file format with LZMA2 compression]" + "7Z_PPMD:[7-Zip file format with PPMd compression]" + "7Z_STORE:[7-Zip file format without compression]" + "7Z_ZSTD:[7-Zip file format with Zstandard compression]" + "AppImage:[AppImage packages]" + "DEB:[Debian packages]" + "External:[CPack External packages]" + "IFW:[Qt Installer Framework]" + "INNOSETUP:[Inno Setup packages]" + "NSIS:[Null Soft Installer]" + "NSIS64:[Null Soft Installer (64-bit)]" + "NuGet:[NuGet packages]" + "RPM:[RPM packages]" + "STGZ:[Self extracting Tar GZip compression]" + "TAR:[Tar no compression]" + "TBZ2:[Tar BZip2 compression]" + "TGZ:[Tar GZip compression]" + "TXZ:[Tar XZ compression]" + "TZ:[Tar Compress compression]" + "TZST:[Tar Zstandard compression]" + "ZIP:[ZIP file format with default compression algorithm]" + "ZIP_BZ2:[ZIP file format with BZip2 compression]" + "ZIP_DEFLATE:[ZIP file format with Deflate compression]" + "ZIP_LZMA:[ZIP file format with LZMA compression]" + "ZIP_LZMA2:[ZIP file format with LZMA2 compression]" + "ZIP_STORE:[ZIP file format without compression]" + "ZIP_ZSTD:[ZIP file format with Zstandard compression]" + ) + + _describe -t 'generators' generator generators +} + +_cpack_help_manuals() { + local -a manuals=(${(f)"$(cpack --help-manual-list 2>/dev/null | sed 's/([0-9]\+)$//' )"}) + _values 'manual' $manuals +} + +_cpack_help_commands() { + local -a commands=(${(f)"$(cpack --help-command-list 2>/dev/null )"}) + _values 'command' $commands +} + +_cpack_help_modules() { + local -a modules=(${(f)"$(cpack --help-module-list 2>/dev/null )"}) + _values 'module' $modules +} + +_cpack_help_policies() { + local -a policies=(${(f)"$(cpack --help-policy-list 2>/dev/null )"}) + _values 'policy' $policies +} + +_cpack_help_properties() { + local -a properties=(${(f)"$(cpack --help-property-list 2>/dev/null )"}) + _values 'property' $properties +} + +_cpack_help_variables() { + local -a variables=(${(f)"$(cpack --help-variable-list 2>/dev/null )"}) + _values 'variable' $variables +} + +_cpack "$@" + +# 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 From a5d34d3aef722ce9e6f5f6a8c6659d54982f3c49 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 26 Mar 2026 13:52:05 +0900 Subject: [PATCH 3/3] Improve portability --- src/_cpack | 4 ++-- src/_ctest | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/_cpack b/src/_cpack index 6619e18..8e73116 100644 --- a/src/_cpack +++ b/src/_cpack @@ -40,7 +40,7 @@ _cpack() { _arguments \ '-G[Override/define CPACK_GENERATOR]:generator:_cpack_generators' \ '-C[Specify the project configurations]:configuration:(Debug Release)' \ - *'-D[Set a CPack variable]:var_val' \ + '*-D[Set a CPack variable]:var_val' \ '--config[Specify the config file]:file:_files' \ '(-V --verbose)'{-V,--verbose}'[Enable verbose output]' \ '--trace[Put underlying cmake scripts in trace mode]' \ @@ -116,7 +116,7 @@ _cpack_generators() { } _cpack_help_manuals() { - local -a manuals=(${(f)"$(cpack --help-manual-list 2>/dev/null | sed 's/([0-9]\+)$//' )"}) + local -a manuals=(${(f)"$(cpack --help-manual-list 2>/dev/null | sed 's/([0-9][0-9]*)$//' )"}) _values 'manual' $manuals } diff --git a/src/_ctest b/src/_ctest index 91d5313..2c6297f 100644 --- a/src/_ctest +++ b/src/_ctest @@ -64,7 +64,7 @@ _ctest() { \*{-FS,--fixture-exclude-setup}'[Do not automatically add setup tests for fixtures matching regular expression]:regex' \ \*{-FC,--fixture-exclude-cleanup}'[Do not automatically add cleanup tests for fixtures matching regular expression]:regex' \ '(--dashboard)'{-D,--dashboard}'[Execute dashboard test]:dashboard' \ - *'-D[Define a variable for script mode]:var' \ + '*-D[Define a variable for script mode]:var' \ '(-M --test-model)'{-M,--test-model}'[Set the model for a dashboard]:model' \ '(-T --test-action)'{-T,--test-action}'[Set the dashboard action to perform]' \ '--group[Specify what build group on the dashboard]:group' \ @@ -84,7 +84,7 @@ _ctest() { '--no-subproject-summary[Disable timing summary information for subprojects]' \ '--test-dir[Specify the directory in which to look for tests]:dir:_files -/' \ '--build-and-test[Configure, build and run a test]' \ - *'--build-target[Specify a specific target to build]:target' \ + '*--build-target[Specify a specific target to build]:target' \ '--build-nocmake[Run the build without running cmake first]' \ '--build-run-dir[Specify directory to run programs from]:dir:_files -/' \ '--build-two-config[Run CMake twice]' \ @@ -96,14 +96,14 @@ _ctest() { '--build-makeprogram[Specify the make program to use]:make:_files' \ '--build-noclean[Skip the make clean step]' \ '--build-config-sample[A sample executable to use to determine the configuration]:sample' \ - *'--build-options[Add extra options to the build step]' \ + '*--build-options[Add extra options to the build step]' \ '--test-command[The test to run with the --build-and-test-option]:command' \ '--test-timeout[The time limit in seconds]:timeout' \ '--test-load[CPU load threshold for starting new parallel tests]:threshold' \ '--tomorrow-tag[starts with next day tag]' \ '--overwrite[Overwrite CTest configuration option]' \ '--extra-submit[Submit extra files to the dashboard]:file:_files' \ - *'--http-header[Append HTTP header when submitting]:header' \ + '*--http-header[Append HTTP header when submitting]:header' \ '--schedule-random[Use a random order for scheduling tests]' \ '--schedule-random-seed[Override seed for random order of tests]:seed' \ '--submit-index[Submit individual dashboard tests with specific index]:index' \ @@ -139,7 +139,7 @@ _ctest() { } _ctest_help_manuals() { - local -a manuals=(${(f)"$(ctest --help-manual-list 2>/dev/null | sed 's/([0-9]\+)$//' )"}) + local -a manuals=(${(f)"$(ctest --help-manual-list 2>/dev/null | sed 's/([0-9][0-9]*)$//' )"}) _values 'manual' $manuals }