summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-03-31 20:39:16 +0200
committerDavid Lönnhager <david.l@mullvad.net>2020-04-17 10:27:24 +0200
commit248643cc78f4c61a2137a7f7bf819a256bab5676 (patch)
tree2b61bf161e78a17f0561e4b01c51dfcfdeac993c
parent7d00a5cf1eabfc4ebb0bbadf7e6445270b848ee1 (diff)
downloadmullvadvpn-248643cc78f4c61a2137a7f7bf819a256bab5676.tar.xz
mullvadvpn-248643cc78f4c61a2137a7f7bf819a256bab5676.zip
Generate and package shell completions
-rwxr-xr-xbuild.sh8
-rw-r--r--gui/tasks/distribution.js4
-rw-r--r--mullvad-cli/src/main.rs3
3 files changed, 14 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index 5b22e97a19..b8f3501f01 100755
--- a/build.sh
+++ b/build.sh
@@ -198,6 +198,14 @@ fi
./update-relays.sh
+if [[ ("$(uname -s)" == "Darwin") || ("$(uname -s)" == "Linux") ]]; then
+ echo "Generating shell completion scripts..."
+ mkdir -p "$SCRIPT_DIR/dist-assets/shell-completions"
+ for sh in bash zsh; do
+ "$CARGO_TARGET_DIR/release/mullvad" shell-completions "$sh" \
+ "$SCRIPT_DIR/dist-assets/shell-completions/"
+ done
+fi
pushd "$SCRIPT_DIR/gui"
diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js
index 85069037a6..0499c810d5 100644
--- a/gui/tasks/distribution.js
+++ b/gui/tasks/distribution.js
@@ -127,6 +127,8 @@ const config = {
'/opt/Mullvad VPN/resources/mullvad-daemon.conf',
distAssets('mullvad') + '=/usr/bin/',
distAssets('linux/problem-report-link') + '=/usr/bin/mullvad-problem-report',
+ distAssets('shell-completions/mullvad.bash') + '=/usr/share/bash-completion/completions/mullvad',
+ distAssets('shell-completions/_mullvad') + '=/usr/local/share/zsh/site-functions/_mullvad',
],
afterInstall: distAssets('linux/after-install.sh'),
afterRemove: distAssets('linux/after-remove.sh'),
@@ -147,6 +149,8 @@ const config = {
'/opt/Mullvad VPN/resources/mullvad-daemon.conf',
distAssets('mullvad') + '=/usr/bin/',
distAssets('linux/problem-report-link') + '=/usr/bin/mullvad-problem-report',
+ distAssets('shell-completions/mullvad.bash') + '=/usr/share/bash-completion/completions/mullvad',
+ distAssets('shell-completions/_mullvad') + '=/usr/local/share/zsh/site-functions/_mullvad',
],
afterInstall: distAssets('linux/after-install.sh'),
afterRemove: distAssets('linux/after-remove.sh'),
diff --git a/mullvad-cli/src/main.rs b/mullvad-cli/src/main.rs
index 2354c79740..a6b4118e96 100644
--- a/mullvad-cli/src/main.rs
+++ b/mullvad-cli/src/main.rs
@@ -102,7 +102,8 @@ fn build_cli(commands: &HashMap<&'static str, Box<dyn Command>>) -> clap::App<'s
clap::Arg::with_name("DIR")
.default_value("./")
.help("Output directory where the shell completions are written"),
- ),
+ )
+ .setting(clap::AppSettings::Hidden),
)
}