Commit 9e4c3886 authored by Éloïs's avatar Éloïs
Browse files

[ref] completion: gen completion script via clap

parent 330ca261
......@@ -79,7 +79,7 @@ chmod 755 duniter-${ARCH}/DEBIAN/post*
chmod 755 duniter-${ARCH}/DEBIAN/pre*
sed -i "s/Version:.*/Version:$DUNITER_DEB_VER/g" duniter-${ARCH}/DEBIAN/control
echo "Extra..."
mv duniter/extra/completion/duniter_completion.bash duniter-${ARCH}/etc/bash_completion.d/duniter_completion.bash
mv duniter/extra/completion/duniter_js_completion.bash duniter-${ARCH}/etc/bash_completion.d/duniter_js_completion.bash
rm -rf duniter/extra
echo "Zipping..."
cd duniter
......
......@@ -45,7 +45,7 @@ build_extra_server() {
mkdir -p "${1}/lib/systemd/system" || exit 1
mv "${RELEASES}/server_/extra/systemd/duniter.service" "${1}/lib/systemd/system" || exit 1
mkdir -p "${1}/etc/bash_completion.d/" || exit 1
mv "${RELEASES}/server_/extra/completion/duniter_completion.bash" "${1}/etc/bash_completion.d/duniter_completion.bash" || exit 1
mv "${RELEASES}/server_/extra/completion/duniter_js_completion.bash" "${1}/etc/bash_completion.d/duniter_js_completion.bash" || exit 1
}
# Debian package building.
......
......@@ -149,7 +149,7 @@ DUNITER_WS2P_ARGS="list-prefered list-privileged list-nodes show-conf"
DUNITER_REACHING_CLEAR_EP_ARGS="clear tor none"
_duniter_completion()
_duniter_js_completion()
{
local cur prev base
COMPREPLY=()
......@@ -198,4 +198,4 @@ _duniter_completion()
return 0
}
complete -F _duniter_completion duniter
complete -F _duniter_js_completion duniter_js
......@@ -30,6 +30,9 @@ if [[ -d $DUN_SOURCES/node ]]; then
ln -s $DUN_SOURCES/bin/duniter /usr/bin/duniter -f
ln -s $DUN_SOURCES/bin/duniter_js /usr/bin/duniter_js -f
cd $DUN_SOURCES
# Generate bash completion script
mkdir -p "/etc/bash_completion.d/"
bin/duniter completions bash > /etc/bash_completion.d/duniter_completion.bash
cd node/bin/
ln -s ../lib/node_modules/npm/bin/npm-cli.js ./npm -f
# Add duniter user for service
......
......@@ -145,7 +145,7 @@ enum DuniterCommand {
/// Generate tab-completion script for your shell
#[structopt(display_order(13))]
Completions {
#[structopt(case_insensitive(true), possible_values = &["BASH, FISH, ZSH"])]
#[structopt(case_insensitive(true))]
shell: Shell,
},
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment