mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2025-09-06 10:30:39 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
824c90904c | |||
58fb5e073a | |||
541a7c2a72 |
17
README.md
17
README.md
@@ -16,10 +16,23 @@
|
|||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
### Why / What?
|
### 💭 Why / What?
|
||||||
|
|
||||||
Autorestic is a wrapper around the amazing [restic](https://restic.net/). While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different location that you want to backup to multiple locations. This utility is aimed at making this easier 🙂
|
Autorestic is a wrapper around the amazing [restic](https://restic.net/). While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different location that you want to backup to multiple locations. This utility is aimed at making this easier 🙂
|
||||||
|
|
||||||
### Questions / Support
|
### 🌈 Features
|
||||||
|
|
||||||
|
- YAML config files, no CLI
|
||||||
|
- Incremental -> Minimal space is used
|
||||||
|
- Backup locations to multiple backends
|
||||||
|
- Snapshot policies and pruning
|
||||||
|
- Fully encrypted
|
||||||
|
- Pre/After hooks
|
||||||
|
- Exclude pattern/files
|
||||||
|
- Cron jobs for automatic backup
|
||||||
|
- Backup & Restore docker volume
|
||||||
|
- Generated completions for `[bash|zsh|fish|powershell]`
|
||||||
|
|
||||||
|
### ❓ Questions / Support
|
||||||
|
|
||||||
Check the [discussions page](https://github.com/cupcakearmy/autorestic/discussions)
|
Check the [discussions page](https://github.com/cupcakearmy/autorestic/discussions)
|
||||||
|
70
cmd/completion.go
Normal file
70
cmd/completion.go
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var completionCmd = &cobra.Command{
|
||||||
|
Use: "completion [bash|zsh|fish|powershell]",
|
||||||
|
Short: "Generate completion script",
|
||||||
|
Long: `To load completions:
|
||||||
|
|
||||||
|
Bash:
|
||||||
|
|
||||||
|
$ source <(autorestic completion bash)
|
||||||
|
|
||||||
|
# To load completions for each session, execute once:
|
||||||
|
# Linux:
|
||||||
|
$ autorestic completion bash > /etc/bash_completion.d/autorestic
|
||||||
|
# macOS:
|
||||||
|
$ autorestic completion bash > /usr/local/etc/bash_completion.d/autorestic
|
||||||
|
|
||||||
|
Zsh:
|
||||||
|
|
||||||
|
# If shell completion is not already enabled in your environment,
|
||||||
|
# you will need to enable it. You can execute the following once:
|
||||||
|
|
||||||
|
$ echo "autoload -U compinit; compinit" >> ~/.zshrc
|
||||||
|
|
||||||
|
# To load completions for each session, execute once:
|
||||||
|
$ autorestic completion zsh > "${fpath[1]}/_autorestic"
|
||||||
|
|
||||||
|
# You will need to start a new shell for this setup to take effect.
|
||||||
|
|
||||||
|
fish:
|
||||||
|
|
||||||
|
$ autorestic completion fish | source
|
||||||
|
|
||||||
|
# To load completions for each session, execute once:
|
||||||
|
$ autorestic completion fish > ~/.config/fish/completions/autorestic.fish
|
||||||
|
|
||||||
|
PowerShell:
|
||||||
|
|
||||||
|
PS> autorestic completion powershell | Out-String | Invoke-Expression
|
||||||
|
|
||||||
|
# To load completions for every new session, run:
|
||||||
|
PS> autorestic completion powershell > autorestic.ps1
|
||||||
|
# and source this file from your PowerShell profile.
|
||||||
|
`,
|
||||||
|
DisableFlagsInUseLine: true,
|
||||||
|
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
||||||
|
Args: cobra.ExactValidArgs(1),
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
switch args[0] {
|
||||||
|
case "bash":
|
||||||
|
cmd.Root().GenBashCompletion(os.Stdout)
|
||||||
|
case "zsh":
|
||||||
|
cmd.Root().GenZshCompletion(os.Stdout)
|
||||||
|
case "fish":
|
||||||
|
cmd.Root().GenFishCompletion(os.Stdout, true)
|
||||||
|
case "powershell":
|
||||||
|
cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(completionCmd)
|
||||||
|
}
|
@@ -17,5 +17,6 @@ Autorestic is a wrapper around the amazing [restic](https://restic.net/). While
|
|||||||
- Exclude pattern/files
|
- Exclude pattern/files
|
||||||
- Cron jobs for automatic backup
|
- Cron jobs for automatic backup
|
||||||
- Backup & Restore docker volumes
|
- Backup & Restore docker volumes
|
||||||
|
- Generated completions for `[bash|zsh|fish|powershell]`
|
||||||
|
|
||||||
> :ToCPrevNext
|
> :ToCPrevNext
|
||||||
|
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "1.0.0"
|
const VERSION = "1.0.1"
|
||||||
|
|
||||||
var CI bool = false
|
var CI bool = false
|
||||||
var VERBOSE bool = false
|
var VERBOSE bool = false
|
||||||
|
Reference in New Issue
Block a user