OpenAFS Logo
OpenAFS Workshop

Google Summer of Code 2026 Final Report

Project: Implement shell completion for OpenAFS commands

Contributor: Maria-Alexandra Mincă
Organization: OpenAFS
Mentors: Michael Meffie, Kailas Zadbuke, Mark Vitale
Gerrit Change: https://gerrit.openafs.org/16938/
Development Branch: gsoc-shell-completion
Timeline: May 25, 2026 - August 24, 2026

Project Overview

OpenAFS provides a number of command-line tools for managing and interacting with the distributed file system. Before this project, these tools did not provide shell command-line completion, so users had to type full subcommands and option names manually. Shell completion makes command-line interaction more efficient by reducing repetitive typing and making commonly used commands quicker to enter.

This project focused on adding shell completion support for OpenAFS commands without keeping separate hard-coded lists of subcommands and options in the shell scripts. Instead, the completion mechanism uses the command syntax already registered with the OpenAFS command library. Bash and Zsh completion scripts can then use that information to suggest completions for supported commands.

Project Goals

Work Accomplished

The project started with a small proof of concept using tests/cmd/comptest to explore how shell completion could work with OpenAFS commands. After testing the basic idea with Bash, the completion logic was moved into the OpenAFS command library so it could be reused by real commands instead of being implemented separately for each one.

An internal -completion-helper option was added for commands using the cmd library. The shell completion scripts pass the current command-line state to this helper, including the word being completed and the words already typed. The helper uses the syntax registered by each OpenAFS command to determine whether subcommands or option names should be suggested and filters the results based on the options that have already been used. It also handles options that may be repeated, hidden options and options that are waiting for a value.

Bash and Zsh completion scripts were added under src/tools/completions/. Both scripts use the same -completion-helper interface and register completion for the OpenAFS commands that support it. Since the completion candidates come from the command syntax itself, new options or subcommands added to an already supported command can automatically become available for completion.

Testing and Documentation

A set of unit tests was added for the completion helper using tests/cmd/comptest. The tests cover top-level subcommand completion, aliases, option completion, repeated options, behaviors for different option types, invalid completion input and other edge cases.

A README was added under src/tools/completions/ to explain how the completion helper works, how to enable the Bash and Zsh completion scripts, which commands are currently supported and the main limitations of the implementation.

Code Contributions and Upstream Status

The final implementation has been submitted to OpenAFS Gerrit and is currently available as change 16938. It has not been merged into the OpenAFS master branch yet and is still going through the review process.

Limitations and Future Work

The main goals of the project were completed, although there are still a few areas where the current completion support could be extended:

One current limitation is that new command executables still need to be added manually to the Bash and Zsh completion scripts.

Challenges and Lessons Learned

One of the main challenges for me was understanding how shell completion works and how Bash and Zsh provide the information needed to generate completion suggestions. I also had to learn more about the OpenAFS command-line infrastructure and how commands register their syntax with the cmd library before I could integrate the completion helper into it.

Another important part of the project was getting more comfortable with Git and the workflow used by OpenAFS. Throughout the project, I gained more experience using Git and became much more confident working with it.

I also learned a lot about working as part of an open source project. Discussing design decisions, asking for feedback, reviewing changes with my mentors and updating the implementation based on that feedback were all important parts of the development process.

Acknowledgments

I would like to thank Michael Meffie, Kailas Zadbuke, Mark Vitale and Gaurav Saxena for their guidance, feedback, patience and support throughout the project. I also want to thank the OpenAFS community for welcoming me and giving me the opportunity to contribute and learn during GSoC. It was a wonderful experience that taught me a lot, both technically and in terms of collaboration and open source development. It also encouraged me to continue contributing to open source in the future.