nextcloud / nextcloud/server

Auto tab completion for bash

Open
#35,450 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3. to review enhancement feature: occ
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Is your feature request related to a problem? Please describe.
Having bash tab/auto completion for occ would make administration much easier.

The current method is not discoverable (multiple NextCloud admins had no idea it existed), and requires fiddling with file ownership / permissions. #14309, https://github.com/stecman/symfony-console-completion/issues/71.

Describe the solution you'd like
A method of invoking bash tab completion that is obvious and works like other bash completions.

Describe alternatives you've considered
A script, bash-add-alias.sh that will

  • build an alias for the user by detecting system settings (web server user, path of occ, etc.)
    • i.e. alias occ='sudo --user www-data php /var/www/nextcloud/occ'
  • run the alias
  • add the alias to the user's ~/.bash_aliases for persistence
  • add the alias to the SUDO_USER's .bash_aliases for persistence
  • run the complete.occ script to enable bash tab completion
  • copy the complete.occ script to directory so it's run each time bash is started
    • (i.e. /etc/bash_completion.d/)
  • set appropriate file owner and write permissions on /etc/bash_completion.d/complete.occ
  • verify that the file owner of occ is the same as the web server user detected

Additional context
Pull request is ready for testing. Needs better OS agnostic support (i.e. different web server user names and bash_completion.d directory locations).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the mentioned bash-add-alias.sh and complete.occ scripts, along with the occ command and the /etc/bash_completion.d/ location. Check the pull request described in the issue and test how completion, aliases, ownership, permissions, and bash-completion paths behave across operating systems; done means an obvious occ completion setup that works without manual permission fixes.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, php
Domain
cli, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.