Closed Mythos-404 closed 1 year ago
Bot detected the issue body's language is not English, translate it automatically.
Title: Add zsh completion prompt
原本就支持 https://github.com/xmake-io/xmake/blob/master/xmake/scripts/completions/register-completions.zsh
走一键脚本安装,或者 xmake update --integrate 才会安装自动补全
这个补全跟zsh插件不兼容
我实现的
Bot detected the issue body's language is not English, translate it automatically.
This completion is not compatible with the zsh plugin
I achieved
这个补全跟zsh插件不兼容
具体不兼容在哪,我看不是在 work 的么
你实现的用不了。这边补全 不管 bash,zsh 还是 fish 最后都会统一路由到 lua 层自动获取的补全列表,不可能挨个硬编码搞得,不好维护。
Bot detected the issue body's language is not English, translate it automatically.
This completion is not compatible with zsh plugins
Where is the specific incompatibility? I don’t think it’s working.
You can't use it. The completion here, no matter bash, zsh or fish, will be uniformly routed to the completion list automatically obtained by the lua layer in the end. It is impossible to hard-code one by one, and it is not easy to maintain.
补全插件无法使用的原因是需要调用zsh提供的补全函数
_xmake() {
local -a completions
completions="$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.utils.complete 0 nospace "$words")"
completions=("${(ps:\n:)completions}")
_describe 'tasks' completions
}
但是调用zsh补全函数需要把补全脚本放到$fpath
路径才能正常使用
哪个 $fpath 路径?反正上面的整体 lua 逻辑不能动,外面的 zsh 脚本如果有问题 可以提 pr 修复
Bot detected the issue body's language is not English, translate it automatically.
Which $fpath path? Anyway, the overall lua logic above cannot be moved. If there is any problem with the external zsh script, you can submit a pr to fix it.
在我Arch上路径是/usr/share/zsh/site-functions/
其他的工具也是放在这里如exa, fd, bat
等
但这个地方需要root权限才能把文件移动到这里
走 xmake update --integrate
会注入 ~/.xmake/profile
到 .zshrc 的启动脚本 。。。而 ~/.xmake/profile
会引入对 zsh 补全函数的定义。。不需要root 也能带进来。。
我这目前测试 zsh 补全可以正常 work
Bot detected the issue body's language is not English, translate it automatically.
Running
xmake update --integrate
will inject~/.xmake/profile
into the .zshrc startup script. . . And~/.xmake/profile
will import the definition of zsh completion function. . Can be brought in without root. .
I am currently testing that zsh completion can work normally
我这里使用xmake update --integrate
注入的补全会让zsh插件无法使用
不过不排除是个例的可能
Bot detected the issue body's language is not English, translate it automatically.
The completion injected by
xmake update --integrate
here will make the zsh plugin unusable However, the possibility of being an exception cannot be ruled out.
是补全的函数里面对 words 的读取有点问题导致只能补全到 action ,无法补全到参数名和值,我修复了,你再试试。。
xmake update -s dev
xmake update --integrate
source ~/.xmake/profile
https://github.com/xmake-io/xmake/commit/e14f298f88acfa8417eaa1c26e43ac8f345fd763
我插件还是无法使用
这个Freed-Wu/fzf-tab-source
插件应该只能识别_describe
,_arguments
等内置补全函数
只有改为
_xmake
#compdef xmake
_xmake()
{
local completions="$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.utils.complete 0 nospace "$words")"
completions=("${(ps:\n:)completions}")
_describe 'tasks' completions
}
_xrepo
_xrepo()
{
local completions="$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.xrepo.complete 0 nospace "$words")"
completions=("${(ps:\n:)completions}")
_describe '' completions
}
然后放到/usr/share/zsh/site-functions/
目录才能正常使用
修改前:
我想请问一下如何制作主题,我发现没有这方面的文档
我插件还是无法使用 这个Freed-Wu/fzf-tab-source插件应该只能识别_describe,_arguments等内置补全函数
插件我就不管了,反正目前我能保证 zsh 原生补全一切正常,其他的三方插件支持问题,你可以自己研究下,或者自己把补全函数放过去。。也可以提 issues 给对应插件,让他们支持
Bot detected the issue body's language is not English, translate it automatically.
My plugin still doesn't work This Freed-Wu/fzf-tab-source plugin should only recognize built-in completion functions such as _describe, _arguments, etc.
I don’t care about plug-ins, anyway, I can guarantee that zsh’s native completion is normal. You can study other third-party plug-in support issues by yourself, or put the completion function by yourself. .
我想请问一下如何制作主题,我发现没有这方面的文档
什么主题? xmake 主题可以翻下源码,或者看下文档。。不同的问题 单独开 issues/discussions
Bot detected the issue body's language is not English, translate it automatically.
I would like to ask how to make a theme, I found no documentation on this
what subject? For the xmake theme, you can turn to the source code, or read the documentation. . Separate issues/discussions for different issues
好的,我会单独开一个仓库来存放zsh的补全文件用来兼容插件
Bot detected the issue body's language is not English, translate it automatically.
Ok, I will open a separate warehouse to store zsh completion files for compatibility with plugins
Which $fpath path? Anyway, the overall lua logic above cannot be moved.
I can provide some details. bash/zsh/fish's completion should be put in some specific directories to be detected automatically.
Such as:
for powershell, it should be $PATH
IIRC
Take zsh as an example. It has an array named $fpath
. fpath contains some
element such as /usr/share/zsh/functions/Completion, store the shell completion
scripts attached to zsh itself: ls, cp, mv, ... And it contains
/usr/share/zsh/site-functions, third-party developer can store their completion
script to this directory. such as:
% ls /usr/share/zsh/site-functions
'_$' _cppcheck _gpustat _markdown-it _periscope _ruff _thor
_afew _ctr _grpcurl _mc _perl-rename _sbt _timedatectl
_android _curl _gscholar _mdcat _pgsql_utils _scala _tmuxinator
_ansifilter _dad _gtk-launch _mdformat _phing _scrcpy _tmux-language-server
_arch-hs _dart _has _mdless _pip _screencapture _torchrun
_arch-hs-diff _datasets-cli _hello _meson _pip-compile _scrub _tox
_arch-hs-sync _delta _hg _middleman _pip-sync _sdd _tqdm
_archlinux-java _dget _hledger _mina _pix2tex _sd_hosts_or_user_at_host _trans
_aria2c _dhcpcd _homestead _mix _pixz _sdkmanager _trash
_artisan _diana _hostnamectl _mkcert _pkcon _sd_machines _trash-empty
_asciinema _direnv _httpie _mkinitcpio _pkgbuild-language-server _sd_outputmodes _trash-list
_atach _docker _huggingface-cli _mssh _pkgfile _sd_unit_files _trash-put
_autoconf-language-server _docpad _hyfetch _mussh _pkgstats _setcap _trash-restore
_autotools-language-server _doq _hyperfine _mutt-language-server _play _setup.py _tsc
_avdmanager _dotnet _ibus _mvn _pm2 _sfdx _ts-node
_bat _drush _include-what-you-use _nano _poetry _shellcheck _typst
_bitbake-language-server _ecdsautil _insights _nanoc _port _showoff _udevadm
_bitcoin-cli _emacs _interactively _neofetch _portage-language-server _shtab _udisks2
_bootctl _emacsclient _inxi _networkctl _pre-commit _snapper _udisksctl
_bower _email-notmuch _iverilog _networkQuality _progress _sphinx-apidoc _ufw
_btm _emulator _jmeter _nftables _protoc _sphinx-autogen _updpkgsums
_bundle _envdir _jmeter-plugins _ninja _proxychains _sphinx-build _vimdoc
_busctl _expect-language-server _jonas _node _ptpython _sphinx-quickstart _virtualbox
_bwrap _exportfs _journalctl _notmuch _pudb _srm _visidata
_cap _eza _jpegai _nvim _pulseaudio _stack _vivid
_cargo _fab _jrnl _nvm _pyenv _sublime-syntax-language-server _vnstat
_cask _fail2ban-client _kak _onefetch _pygmentize _subliminal _vvp
_ccache _fd _kernel-install _oomctl _pytest _supervisorctl _wandb
_cf _ffind _keyring _openssl _qmk _svlint _wb
_cgdb _fleetctl _kitchen _openvpn3 _qpdf _svm _wemux
_chafa _flutter _knife _optirun _rails _systemctl _wezterm
_checkupdates _fvm _kscreen-doctor _paccache _ralio _systemd _wgetpaste
_choc _fwupdmgr _l3build _pacdiff _rankmirrors _systemd-analyze _wg-quick
_chromium _gas _language_codes _paclist _redis-cli _systemd-delta _xilinx-language-server
_clang-check _gh _less _paclog-pkglist _requirements-language-server _systemd-inhibit _xsel
_clang-format _ghc _lftp _pacman _resolvectl _systemd-nspawn _yarn
_clang-tidy _gist _libinput _pacscripts _revolver _systemd-path _youtube-dl
_cling _git-flow _lilypond _pacsearch _rfkill _systemd-run _zathura
_cmake _gitlab-cli _localectl _pacsort _rg _systemd-tmpfiles _zathura-language-server
_cmus _git-pulls _loginctl _pactree _rkt _teamocil _zcash-cli
_codespell _git-revise _luarocks _parallel _rlwrap _tensorboard _zunit
_coffee _git-wtf _luarocks-admin _paru _rmlint _termux-language-server
_conan _glances _lunchy _pass _rslsync _tesseract
_concourse _golang _machinectl _patchelf _rspec _texdef
_console _google _main.py _patool _rsvm _texdoc
_coredumpctl _gpgconf _make-language-server _pdd _rubocop _textidote
We can source the completion script manually in zshrc. We can also add our script path to fpath
. However, it is not standard.
Other shell is similar. Such as fish:
$ \ls /usr/share/fish/vendor_completions.d
ansifilter.fish arch-hs.fish bat.fish curl.fish docker.fish fd.fish hyperfine.fish luarocks.fish mdless.fish paru.fish pdd.fish pkgstats.fish pyenv.fish ruff.fish wandb.fish wezterm.fish
arch-hs-diff.fish arch-hs-sync.fish btm.fish delta.fish eza.fish gh.fish luarocks-admin.fish mdcat.fish onefetch.fish pass.fish pip.fish poetry.fish rg.fish typst.fish wb.fish zathura.fish
zsh completion script has the following format:
_xmake
:
#compdef xmake
... # content
zsh will read the first line compdef xmake
and filename _xmake
to execute:
_xmake() {
... # content
}
compdef _xmake xmake
Currently, xmake's completion script is not standard as the other programs. It can be improved.
The main question is how to write a patch that automatically gets xmake project information, which was tried when issues was proposed but didn't work very well.
你在什么场景下需要该功能?
在终端调整xmake config没有提示很麻烦
描述可能的解决方案
我已经编写了一份 _xmake 因为是第一次写zsh-completions有些地方实现的不好请指出
xmake completions
```sh #compdef xmake _common_options=( '(-q,--quiet)'{-q,--quiet}'[Quiet operation.]' '(-y,--yes)'{-y,--yes}'[Input yes by default if need user confirm.]' '--confirm=[Input the given result if need user confirm.]:(given result):(yes no def)' '(-v,--verbose)'{-v,--verbose}'[Print lots of verbose information for users.]' '--root[Allow to run xmake as root.]' '(-D,--diagnosis)'{-D,--diagnosis}'[Print lots of diagnosis information (backtrace, check info ..) only for developers.]' '--version[Print the version number and exit.]' '(-h,--help)'{-h,--help}'[Print this help message and exit.]' '(-F,--file=)'{-F,--file=}'[Read a given xmake.lua file.]:(xmake.lua path):_files' '(-P,--project=)'{-P,--project=}'[Change to the given project directory.]:(project path):_files -/' ) _xmake() { local line typeset -A opt_args _arguments -C \ "${_common_options[@]}" \ '(-b,--build)'{-b,--build}'[Build target. This is default building mode and optional.]' \ '(-r,--rebuild)'{-r,--rebuild}'[Rebuild the target.]' \ '(-a,--all)'{-a,--all}'[Build all target.]' \ '(-g,--group=)'{-g,--group=}'[Build all targets of the given group. It support path pattern matching.]' \ '--dry-run[Dry run to build target.]' \ '(-j,--jobs=)'{-j,--jobs=}'[Set the number of parallel compilation jobs.]:(number)' \ '--linkjobs[Set the number of parallel link jobs.]:(number)' \ '(-w,--warning)'{-w,--warning}'[Enable the warnings output.]' \ '--files=[Build the given source files.]:files:_files' \ '1: :_xmake_task' \ '*::task:->task' case $state in task) local -a targets targets=($(xmake show -l targets | sed 's/\x1b\[[0-9;]*m//g')) case $words[1] in b | build) _arguments \ "${_common_options[@]}" \ '(-b,--build)'{-b,--build}'[Build target. This is default building mode and optional.]' \ '(-r,--rebuild)'{-r,--rebuild}'[Rebuild the target.]' \ '(-a,--all)'{-a,--all}'[Build all target.]' \ '(-g,--group=)'{-g,--group=}'[Build all targets of the given group. It support path pattern matching.]' \ '--dry-run[Dry run to build target.]' \ '(-j,--jobs=)'{-j,--jobs=}'[Set the number of parallel compilation jobs.]:(number)' \ '--linkjobs[Set the number of parallel link jobs.]:(number)' \ '(-w,--warning)'{-w,--warning}'[Enable the warnings output.]' \ '--files=[Build the given source files.]:files:_files' \ '*::target:->_xmake_target' case $state in _xmake_target) _describe "targets" targets ;; esac ;; esac case $words[1] in r | run) _arguments \ "${_common_options[@]}" \ '(-d,--debug)'{-d,--debug}'[Run and debug the given target.]' \ '(-a,--all)'{-a,--all}'[Run all targets.]' \ '(-w,--workdir=)'{-w,--workder=}'[ork directory of running targets, default is folder of targetfile.]:(workdir path):_files -/' \ '(-j,--jobs=)'{-j,--jobs=}'[Set the number of parallel compilation jobs.]:(number)' \ '--detach[Run targets in detached processes.]' \ '*::target:->_xmake_target' case $state in _xmake_target) _describe "targets" targets ;; esac ;; esac case $words[1] in create) _arguments \ "${_common_options[@]}" \ '(-f,--force)'{-f,--force}'[Force to create project in a non-empty directory.]' \ '(-l --language=)'{-l,--language=}'[The project language.]:(language):(c c++ rust nim cuda go zig fortran pascal dlang vala swift objc objc++)' \ '(-t --template=)'{-t,--template=}'[Select the project template id or name of the given language.]:(template):(console qt.console qt.quickapp qt.quickapp_static qt.shared qt.static qt.widgetapp qt.widgetapp_static shared static tbox.console tbox.shared tbox.static wxwidgets xcode.bundle xcode.framework xcode.iosapp xcode.iosapp_with_framework xcode.macapp xcode.macapp_with_framework xmake.cli)' ;; esac case $words[1] in f | conFig) local toolchains_list toolchains_list=($(xmake show -l toolchains | grep -o '^\s*\w\+' | cat)) _arguments -C \ "${_common_options[@]}" \ '(-c,--clean)'{-c,--clean}'[Clean the cached user configs and detection cache.]' \ '--check[Just ignore detection cache and force to check all, it will reserve the cached user configs.]' \ '--export=[Export the current configuration to the given file.]:file:_files' \ '--import=[Import configs from the given file.]:file:_files' \ '--menu[Configure project with a menu-driven user interface.]' \ '(-p,--plat=)'{-p,--plat=}'[Compile for the given platform.]:platform:(cross macosx appletvos watchos bsd wasm haiku iphoneos mingw android linux cygwin windows msys)' \ '(-a,--arch=)'{-a,--arch=}'[Compile for the given architecture.]:architecture:(i386 x86_64 arm arm64 mips mips64 riscv riscv64 s390x ppc ppc64 sh4)' \ '(-m,--mode=)'{-m,--mode=}'[Compile for the given mode.]:mode:(debug release)' \ '(-k,--kind=)'{-k,--kind=}'[Compile for the given target kind.]:kind:(static shared binary)' \ '--host=[Set the current host environment.]:host' \ '--policies=[Set the project policies.]:policies' \ '--require=[Require all dependent packages?]:require:(yes no)' \ '--pkg_searchdirs=[The search directories of the remote package.]:dirs:_files -/' \ '--cross=[Set cross toolchains prefix]:prefix' \ '--target_os=[Set target os only for cross-compilation]:target_os' \ '--bin=[Set cross toolchains bin directory]:bin:_files -/' \ '--sdk=[Set cross SDK directory]:sdk:_files -/' \ '--toolchain=[Set toolchain name]:toolchain:($toolchains_list)' \ '--as=[The Assembler]:as' \ '--ar=[The Static Library Linker]:ar' \ '--ld=[The Linker]:ld' \ '--sh=[The Shared Library Linker]:sh' \ '--asflags=[The Assembler Flags]:asflags' \ '--ldflags=[The Binary Linker Flags]:ldflags' \ '--arflags=[The Static Library Linker Flags]:arflags' \ '--shflags=[The Shared Library Linker Flags]:shflags' \ '--links=[The Link Libraries]:links' \ '--syslinks=[The System Link Libraries]:syslinks' \ '--linkdirs=[The Link Search Directories]:linkdirs:_files -/' \ '--includedirs=[The Include Search Directories]:includedirs:_files -/' \ '--rc=[The Rust Compiler]:rc' \ '--rcld=[The Rust Linker]:rcld' \ '--rcar=[The Rust Static Library Archiver]:rcar' \ '--rcsh=[The Rust Shared Library Linker]:rcsh' \ '--fc=[The Fortran Compiler]:fc' \ '--fcld=[The Fortran Linker]:fcld' \ '--fcsh=[The Fortran Shared Library Linker]:fcsh' \ '--cu=[The Cuda Compiler]:cu' \ '--cu-ccbin=[The Cuda Host C++ Compiler]:cu-ccbin' \ '--culd=[The Cuda Linker]:culd' \ '--cuflags=[The Cuda Compiler Flags]:cuflags' \ '--culdflags=[The Cuda Linker Flags]:culdflags' \ '--nc=[The Nim Compiler]:nc' \ '--ncld=[The Nim Linker]:ncld' \ '--ncar=[The Nim Static Library Archiver]:ncar' \ '--ncsh=[The Nim Shared Library Linker]:ncsh' \ '--sc=[The Swift Compiler]:sc' \ '--scld=[The Swift Linker]:scld' \ '--scsh=[The Swift Shared Library Linker]:scsh' \ '--frameworks=[The Frameworks]:frameworks' \ '--frameworkdirs=[The Frameworks Search Directories]:frameworkdirs:_files -/' \ '--zc=[The Zig Compiler]:zc' \ '--zcld=[The Zig Linker]:zcld' \ '--zcar=[The Zig Static Library Archiver]:zcar' \ '--zcsh=[The Zig Shared Library Linker]:zcsh' \ '--mrc=[The Microsoft Resource Compiler]:mrc' \ '--mrcflags=[The Microsoft Resource Flags]:mrcflags' \ '--mm=[The Objc Compiler]:mm' \ '--mxx=[The Objc++ Compiler]:mxx' \ '--mflags=[The Objc Compiler Flags]:mflags' \ '--mxflags=[The Objc/c++ Compiler Flags]:mxflags' \ '--mxxflags=[The Objc++ Compiler Flags]:mxxflags' \ '--dc=[The Dlang Compiler]:dc' \ '--dcld=[The Dlang Linker]:dcld' \ '--dcar=[The Dlang Static Library Archiver]:dcar' \ '--dcsh=[The Dlang Shared Library Linker]:dcsh' \ '--go=[The Golang Compiler]:go' \ '--gcld=[The Golang Linker]:gcld' \ '--go-ar=[The Golang Static Library Linker]:go-ar' \ '--cc=[The C Compiler]:cc' \ '--cxx=[The C++ Compiler]:cxx' \ '--cpp=[The C Preprocessor]:cpp' \ '--ranlib=[The Static Library Index Generator]:ranlib' \ '--cflags=[The C Compiler Flags]:cflags' \ '--cxflags=[The C/C++ compiler Flags]:cxflags' \ '--cxxflags=[The C++ Compiler Flags]:cxxflags' \ '--pc=[The Pascal Compiler]:pc' \ '--pcld=[The Pascal Linker]:pcld' \ '--pcsh=[The Pascal Shared Library Linker]:pcsh' \ '(-o,--buildir=)'{-o,--buildir=}'[Set build directory.]:build_directory:_files -/' # Define the tasks for the config subcommand local -a config_tasks config_tasks=( "clean:Clean the cached user configs and detection cache." "check:Just ignore detection cache and force to check all, it will reserve the cached user configs." "export:Export the current configuration to the given file." "import:Import configs from the given file." "menu:Configure project with a menu-driven user interface." ) # Perform completion based on the current word and the config tasks _describe -t tasks 'tasks' config_tasks "$@" ;; esac case $words[1] in g | global) _arguments \ "${_common_options[@]}" \ '--menu[Configure with a menu-driven user interface.]' \ '--theme=[The theme name. (default: default)]: :(default ninja emoji dark light plain powershell)' \ '--debugger=[The debugger program path. (default: auto)]: :_files' \ '--ccache=[Enable or disable the c/c++ compiler cache.]: :(y n)' \ '--build_warning=[Enable the warnings output by default when building.]' \ '--cachedir=[The global cache directory.]: :_files -/' \ '--network=[Set the network mode. (default: public)]: :(public private)' \ '--insecure-ssl=[Disable to check ssl certificates for downloading.]: :(y n)' \ '-x[Use proxy on given port.]:proxy:(http https socks5)' \ '--proxy_hosts=[Only enable proxy for the given hosts list, it will enable all if unset, and we can pass match pattern to list.]:proxy hosts' \ '--proxy_pac=[Set the auto proxy configuration file. (default: pac.lua)]: :_files' \ '--pkg_searchdirs=[The search directories of the remote package.]: :_files -/' \ '--pkg_cachedir=[The cache root directory of the remote package.]: :_files -/' \ '--pkg_installdir=[The install root directory of the remote package.]: :_files -/' \ '--emsdk=[The emsdk directory]: :_files -/' \ '--mingw=[The MingW SDK Directory]: :_files -/' \ '--ndk=[The NDK Directory]: :_files -/' \ '--ndk_sdkver=[The SDK Version for NDK (default: auto)]: :_files' \ '--android_sdk=[The Android SDK Directory]: :_files -/' \ '--build_toolver=[The Build Tool Version of Android SDK]: :_files' \ '--cuda=[The Cuda SDK Directory (default: auto)]: :_files -/' \ '--qt=[The Qt SDK Directory (default: auto)]: :_files -/' \ '--vcpkg=[The Vcpkg Directory (default: auto)]: :_files -/' ;; esac case $words[1] in c | clean) _arguments -C \ "${_common_options[@]}" \ '(-a,--all)'{-a,--all}'[Clean all auto-generated files by xmake.]' \ '*::target:->_xmake_target' case $state in _xmake_target) _describe "targets" targets ;; esac ;; esac case $words[1] in q | require) _arguments -C \ "${_common_options[@]}" \ '(-c,--clean)'{-c,--clean}'[Clear all package caches and uninstall all not-referenced packages.]' \ '--clean_modes=[Set the modes of cleaning packages.]:modes:(cache package)' \ '(-f,--force)'{-f,--force}'[Force to reinstall all package dependencies.]' \ '(-j,--jobs=)'{-j,--jobs=}'[Set the number of parallel compilation jobs.]:(number)' \ '--linkjobs[Set the number of parallel link jobs.]:(number)' \ '--shallow[Does not install dependent packages.]' \ '--build[Always build and install packages from source.]' \ '(-l,--list)'{-l,--list}'[List all package dependencies in the project.]' \ '--scan[Scan the given or all installed packages.]' \ '--info[Show the given package info.]' \ '--fetch[Fetch the library info of the given package.]' \ '--fetch_modes=[Set the modes of fetching packages.]:modes:(cflags external deps cflags,ldflags)' \ '(-s,--search)'{-s,--search}'[Search for the given packages from repositories.]' \ '--upgrade[Upgrade the installed packages.]' \ '--uninstall[Uninstall the installed packages.]' \ '--export[Export the installed packages and their dependencies.]' \ '--import[Import the installed packages and their dependencies.]' \ '--packagedir=[Set the packages directory for exporting and importing.]:packagedir:(packages): _files -/' \ '--debugdir=[Set the source directory of the current package for debugging.]:debugdir:_files -/' \ '--extra=[Set the extra info of packages.]:extra' ;; esac case $words[1] in p | package) _arguments -C \ "${_common_options[@]}" \ '(-o,--outputdir=)'{-o,--outputdir=}'[Set the output directory.]:(output dir):_files -/' \ '(-a,--all)'{-a,--all}'[Package all targets.]' \ '(-f,--format=)'{-f,--format=}'[Set the package format.]:format:(oldpkg local remote)' \ '--homepage=[Set the homepage of package.]:(homepage)' \ '--description=[Set the description of package.]:(description)' \ '--url=[Set the url of remote package.]:(url)' \ '--version=[Set the version of remove package.]:(version)' \ '--shasum=[Set the sha256 or commit of remote package.]:(shasum)' \ '*::target:->_xmake_target' case $state in _xmake_target) _describe "targets" targets ;; esac ;; esac case $words[1] in i | install) _arguments -C \ "${_common_options[@]}" \ '(-o,--installdir=)'{-o,--installdir=}'[Set the install directory.]:(install dir):_files -/' \ '(-g,--group=)'{-g,--group=}'[Install all targets of the given group. It supports path pattern matching.]' \ '(-a,--all)'{-a,--all}'[Install all targets.]' \ '--nopkgs[Only install targets without packages.]' \ '--admin[Try to request administrator permission to install.]' \ '*::target:->_xmake_target' case $state in _xmake_target) _describe "targets" targets ;; esac ;; esac case $words[1] in u | uninstall) _arguments \ "${_common_options[@]}" \ '--installdir=[Set the install directory.]' \ '(-p,--prefix=)'{-p,--prefix=}'[Set the prefix directory.]:(prefix)' \ '--admin=[Try to request administrator permission to uninstall.]' \ '*::target:->_xmake_target' case $state in _xmake_target) _describe "targets" targets ;; esac ;; esac case $words[1] in update) _arguments -C \ "${_common_options[@]}" \ '--uninstall[Uninstall the current xmake program.]' \ '(-s,--scriptonly)'{-s,--scriptonly}'[Update scripts only.]' \ '--integrate[Integrate xmake with the default shell.]' \ '(-f,--force)'{-f,--force}'[Force to update and reinstall the given version.]' ;; esac case $words[1] in service) _arguments \ "${_common_options[@]}" \ '--start[Start daemon service.]' \ '--restart[Restart daemon service.]' \ '--stop[Stop daemon service.]' \ '--connect[Connect current project to the remote daemon service.]' \ '--reconnect[Reconnect current project to the remote daemon service.]' \ '--disconnect[Disconnect current project in the remote daemon service.]' \ '--remote[Start or connect the remote build service.]' \ '--distcc[Start or connect the distributed build service.]' \ '--ccache[Start or connect the remote c/c++ cache service.]' \ '--sync[Sync current project files in the remote daemon service.]' \ '--pull[Pull the given file or directory in the remote daemon service.]:(file or directory):_files -/' \ '--clean[Clean current project files in the remote daemon service.]' \ '--add-user=[Add user in the server.]:(user)' \ '--rm-user=[Remove user in the server.]:(user)' \ '--gen-token[Generate a new token in the server.]' \ '--logs[Show service logs if the daemon service has been started.]' \ '--status[Show service status if the daemon service has been started.]' ;; esac ;; esac } _xmake_task() { local -a tasks tasks=( "f:Configure the project." "config:Configure the project." "r:Run the project target." "run:Run the project target." "b:Build targets if no given tasks." "build:Build targets if no given tasks." "create:Create a new project." "g:Configure the global options for xmake." "global:Configure the global options for xmake." "i:Package and install the target binary files." "install:Package and install the target binary files." "u:Uninstall the project binary files." "uninstall:Uninstall the project binary files." "c:Remove all binary and temporary files." "clean:Remove all binary and temporary files." "p:Package target." "package:Package target." "update:Update and uninstall the xmake program." "service:Start service for remote or distributed compilation and etc." ) _describe -t tasks 'tasks' tasks "$@" } ```