Skip to content

Bash completion script#504

Open
iconoclasthero wants to merge 1 commit intolinuxmint:masterfrom
iconoclasthero:bash_completion
Open

Bash completion script#504
iconoclasthero wants to merge 1 commit intolinuxmint:masterfrom
iconoclasthero:bash_completion

Conversation

@iconoclasthero
Copy link
Copy Markdown

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.

@mtwebster
Copy link
Copy Markdown
Member

If this needs to be installed you need to place it update the meson build do to so.

  • Move the file into 'files'
  • Update the meson build there (install_data) probably.

This is also missing some option aliases like:

  • --comment
  • --snapshot-name
  • --backup-device

@iconoclasthero
Copy link
Copy Markdown
Author

iconoclasthero commented Apr 2, 2026

This is also missing some option aliases like:

  • --comment
  • --snapshot-name
  • --backup-device
$ timeshift --help

Timeshift v25.12.4 by Tony George (teejeetech@gmail.com)

Syntax:

  timeshift --check
  timeshift --create [OPTIONS]
  timeshift --restore [OPTIONS]
  timeshift --delete-[all] [OPTIONS]
  timeshift --list-{snapshots|devices} [OPTIONS]

Options:

List:
  --list[-snapshots]         List snapshots
  --list-devices             List devices

Backup:
  --check                    Create snapshot if scheduled
  --create                   Create snapshot (even if not scheduled)
  --comments <string>        Set snapshot description
  --tags {O,B,H,D,W,M}       Add tags to snapshot (default: O)

Restore:
  --restore                  Restore snapshot
  --snapshot <name>          Specify snapshot to restore
  --target[-device] <device> Specify target device
  --grub[-device] <device>   Specify device for installing GRUB2 bootloader
  --skip-grub                Skip GRUB2 reinstall

Delete:
  --delete                   Delete snapshot
  --delete-all               Delete all snapshots

Global:
  --snapshot-device <device> Specify backup device (default: config)
  --yes                      Answer YES to all confirmation prompts
  --btrfs                    Switch to BTRFS mode (default: config)
  --rsync                    Switch to RSYNC mode (default: config)
  --debug                    Show additional debug messages
  --verbose                  Show rsync output (default)
  --quiet                    Hide rsync output
  --scripted                 Run in non-interactive mode
  --help                     Show all options
  --version                  Print version number

--comment isn't a documented flag; --comments is included.
--snapshot-name isn't a documented flag; --snapshot is included
--backup-device isn't a documented flag; --snapshot-device is included

If these are undocumented aliases, can you please provide a full list? Or document them?

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.

2 participants