From 1bdf61cb201297014c28f0cabcd0510edbf42295 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 13 May 2018 13:59:03 -0500 Subject: [PATCH] Add completions for meson build system --- CHANGELOG.md | 2 ++ share/completions/meson.fish | 52 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 share/completions/meson.fish diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a00ea7b0..1865ca244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ This section is for changes merged to the `major` branch that are not also merge - `configure` (autoconf only) - `j` (autojump #4344) - `jhipster` (#4472) + - `meson` - `ngrok` (#4642) - `optipng` - `port` @@ -74,6 +75,7 @@ This section is for changes merged to the `major` branch that are not also merge - `diskutil` - `git` (#4395, #4396, #4592) - `npm` + - `python`/`python2`/`python3` - `ssh` (#4344) - `yarn` diff --git a/share/completions/meson.fish b/share/completions/meson.fish new file mode 100644 index 000000000..716ec5dad --- /dev/null +++ b/share/completions/meson.fish @@ -0,0 +1,52 @@ +# Completions for the meson build system (http://mesonbuild.com/) + +set -l basic_arguments \ + "h,help,show help message and exit" \ + ",stdsplit,Split stdout and stderr in test logs" \ + ",errorlogs,Print logs from failing test(s)" \ + ",werror,Treat warnings as errors" \ + ",strip,Strip targets on install" \ + "v,version,Show version number and exit" + +set -l dir_arguments \ + ",localedir,Locale data directory [share/locale]" \ + ",sbindir,System executable directory [sbin]" \ + ",infodir,Info page directory [share/info]" \ + ",prefix,Installation prefix [/usr/local]" \ + ",mandir,Manual page directory [share/man]" \ + ",datadir,Data file directory [share]" \ + ",bindir,Executable directory [bin]" \ + ",sharedstatedir,Arch-agnostic data directory [com]" \ + ",libdir,Library directory [system default]" \ + ",localstatedir,Localstate data directory [var]" \ + ",libexecdir,Library executable directory [libexec]" \ + ",includedir,Header file directory [include]" \ + ",sysconfdir,Sysconf data directory [etc]" + +for arg in $basic_arguments + set -l parts (string split , -- $arg) + if not string match -q "" -- $parts[1] + complete -c meson -s "$parts[1]" -l "$parts[2]" -d "$parts[3]" + else + complete -c meson -l "$parts[2]" -d "$parts[3]" + end +end + +for arg in $dir_arguments + set -l parts (string split , -- $arg) + complete -c meson -l "$parts[2]" -d "$parts[3]" -xa '(__fish_complete_directories)' +end + +complete -c meson -s "D" -d "Set value of an option (-D foo=bar)" + +complete -c meson -l buildtype -xa '(string split , plain,debug,debugoptimized,release,minsize)' -d "Set build type [debug]" +complete -c meson -l layout -xa '(string split , mirror,flat)' -d "Build directory layout [mirror]" +complete -c meson -l backend -xa '(string split , ninja,vs,vs2010,vs2015,vs2017,xcode)' -d "Compilation backend [ninja]" +complete -c meson -l default-library -xa '(string split , shared,static,both)' -d "Default library type [shared]" +complete -c meson -l warning-level -xa '(string split , 1,2,3)' -d "Warning level [1]" +complete -c meson -l unity -xa '(string split , on,off,subprojects)' -d "Unity build [off]" +complete -c meson -l cross-file -r -d "File describing cross-compilation environment" +complete -c meson -l wrap-mode -xa '(printf "%s\n" WrapMode.{default,nofallback,nodownload,forcefallback})' -d "Special wrap mode to use" + +# final parameter +complete -c meson -n '__fish_is_first_token' -xa '(__fish_complete_suffix {})'