Skip to content

Conversation

@iconoclasthero
Copy link

Add bash completion for Timeshift

This adds a bash completion script for Timeshift. It includes:

  • Completion for all the main options (--list, --create, --restore, etc.)
  • Snapshot name completion for --snapshot using timeshift --list
  • Safe shell quoting for snapshot names (even though Timeshift snapshot names don't contain spaces, this keeps it robust)
  • Tag completion for --tags

The script is silent if timeshift --list fails or if there are no snapshots, so there are no side effects.

This addresses the feature request FR #502.

It’s placed in a standard bash-completion style and should work for both user and system-wide installations.


Testing Instructions

  1. Copy or link the completion script to your local bash-completion directory:
# system-wide (requires root)
sudo cp timeshift-completion.bash /etc/bash_completion.d/

# OR user-only
mkdir -p ~/.local/share/bash-completion/completions
sudo cp timeshift-completion.bash ~/.local/share/bash-completion/completions/timeshift
  1. Reload bash (or source the script directly for quick testing):
# Reload current shell
source ~/.bashrc

# OR source the script directly
source ./timeshift-completion.bash
  1. Test completion:
# Should complete main options
timeshift --<TAB>

# Should complete snapshot names from `timeshift --list`
timeshift --snapshot <TAB>

# Should complete tags for `--tags`
timeshift --tags <TAB>
  1. Verify that completion is safe and no side effects occur if no snapshots exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant