Skip to content

Commit

Permalink
add bash completion to ncc
Browse files Browse the repository at this point in the history
Signed-off-by: nachoparker <[email protected]>
  • Loading branch information
nachoparker committed Sep 30, 2021
1 parent ced8ac7 commit 7622be8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bin/ncp-update-nc
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ fi
rm -rf /var/www/nextcloud/apps/previewgenerator
ln -snf "${NCPREV}" /var/www/nextcloud/apps/previewgenerator

# refresh completions
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp

# done
####################
mkdir -p "$DATADIR"/ncp-update-backups
Expand Down
6 changes: 6 additions & 0 deletions bin/ncp/CONFIG/nc-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ EOF
ncc config:system:set overwrite.cli.url --value="https://nextcloudpi/"
ncc config:system:set trusted_domains "${TRUSTED_DOMAINS[nc_domain]}" --value="nextcloudpi"

# bash completion for ncc
apt_install bash-completion
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp
echo ". /etc/bash_completion" >> /etc/bash.bashrc
echo ". /usr/share/bash-completion/completions/ncp" >> /etc/bash.bashrc

# TODO temporary workaround for https://github.com/nextcloud/server/pull/13358
ncc -n db:convert-filecache-bigint
ncc db:add-missing-indices
Expand Down
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

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

[v1.39.16](https://github.com/nextcloud/nextcloudpi/commit/2be666b) (2021-09-27) nc-https: proto logic was inverted fix

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

Expand Down
2 changes: 1 addition & 1 deletion ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ install()
# add the ncc shortcut
cat > /usr/local/bin/ncc <<'EOF'
#!/bin/bash
sudo -u www-data php /var/www/nextcloud/occ "$@"
sudo -E -u www-data php /var/www/nextcloud/occ "$@"
EOF
chmod +x /usr/local/bin/ncc

Expand Down
13 changes: 13 additions & 0 deletions updates/1.40.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ EOF
# fix issue with reverse proxy infinite redirections
run_app nc-httpsonly

# bash completion for `ncc`
if ! [[ -f /usr/share/bash-completion/completions/ncp ]]; then
apt_install bash-completion
ncc _completion -g --shell-type bash -p ncc | sed 's|/var/www/nextcloud/occ|ncc|g' > /usr/share/bash-completion/completions/ncp
echo ". /etc/bash_completion" >> /etc/bash.bashrc
echo ". /usr/share/bash-completion/completions/ncp" >> /etc/bash.bashrc
cat > /usr/local/bin/ncc <<'EOF'
#!/bin/bash
sudo -E -u www-data php /var/www/nextcloud/occ "$@"
EOF
chmod +x /usr/local/bin/ncc
fi

# docker images only
[[ -f /.docker-image ]] && {
:
Expand Down

0 comments on commit 7622be8

Please sign in to comment.