Skip to content

Commit 7622be8

Browse files
committed
add bash completion to ncc
Signed-off-by: nachoparker <nacho@ownyourbits.com>
1 parent ced8ac7 commit 7622be8

5 files changed

Lines changed: 26 additions & 2 deletions

File tree

bin/ncp-update-nc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ fi
234234
rm -rf /var/www/nextcloud/apps/previewgenerator
235235
ln -snf "${NCPREV}" /var/www/nextcloud/apps/previewgenerator
236236

237+
# refresh completions
238+
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp
239+
237240
# done
238241
####################
239242
mkdir -p "$DATADIR"/ncp-update-backups

bin/ncp/CONFIG/nc-init.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ EOF
181181
ncc config:system:set overwrite.cli.url --value="https://nextcloudpi/"
182182
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[nc_domain]}" --value="nextcloudpi"
183183

184+
# bash completion for ncc
185+
apt_install bash-completion
186+
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp
187+
echo ". /etc/bash_completion" >> /etc/bash.bashrc
188+
echo ". /usr/share/bash-completion/completions/ncp" >> /etc/bash.bashrc
189+
184190
# TODO temporary workaround for https://github.com/nextcloud/server/pull/13358
185191
ncc -n db:convert-filecache-bigint
186192
ncc db:add-missing-indices

changelog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
[v1.39.16](https://github.com/nextcloud/nextcloudpi/commit/e6ebc3d) (2021-09-27) nc-https: proto logic was inverted fix
2+
[v1.39.17](https://github.com/nextcloud/nextcloudpi/commit/520f062) (2021-09-29) add bash completion to ncc
3+
4+
[v1.39.16](https://github.com/nextcloud/nextcloudpi/commit/2be666b) (2021-09-27) nc-https: proto logic was inverted fix
35

46
[v1.39.15](https://github.com/nextcloud/nextcloudpi/commit/b067844) (2021-09-27) add get_ip function
57

ncp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ install()
3434
# add the ncc shortcut
3535
cat > /usr/local/bin/ncc <<'EOF'
3636
#!/bin/bash
37-
sudo -u www-data php /var/www/nextcloud/occ "$@"
37+
sudo -E -u www-data php /var/www/nextcloud/occ "$@"
3838
EOF
3939
chmod +x /usr/local/bin/ncc
4040

updates/1.40.0.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ EOF
3636
# fix issue with reverse proxy infinite redirections
3737
run_app nc-httpsonly
3838

39+
# bash completion for `ncc`
40+
if ! [[ -f /usr/share/bash-completion/completions/ncp ]]; then
41+
apt_install bash-completion
42+
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp
43+
echo ". /etc/bash_completion" >> /etc/bash.bashrc
44+
echo ". /usr/share/bash-completion/completions/ncp" >> /etc/bash.bashrc
45+
cat > /usr/local/bin/ncc <<'EOF'
46+
#!/bin/bash
47+
sudo -E -u www-data php /var/www/nextcloud/occ "$@"
48+
EOF
49+
chmod +x /usr/local/bin/ncc
50+
fi
51+
3952
# docker images only
4053
[[ -f /.docker-image ]] && {
4154
:

0 commit comments

Comments
 (0)