2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-28 15:56:37 +00:00

Extend help output with short overview

The list of subcommands can be confusing for first time users. This
adds a short overview of the most important commands to help get people
started.
This commit is contained in:
Konrad Wojas 2021-01-11 11:50:02 +08:00 committed by Michael Eischer
parent 98fb56baa6
commit 5bd8a6d7eb
2 changed files with 38 additions and 6 deletions

View File

@ -0,0 +1,6 @@
Enhancement: Extend cli help output
Added a short overview of the most important commands to the commandline
help output to help new users get started.
https://github.com/restic/restic/pull/3225

View File

@ -18,14 +18,40 @@ import (
"github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/errors"
) )
// LongDescription is shown in the cli help output
const LongDescription = `
restic is a backup program which allows saving multiple revisions of files and
directories in an encrypted repository stored on different backends.
To get started with a local test repository, first define some environment variables:
export RESTIC_REPOSITORY=/tmp/restic-example
export RESTIC_PASSWORD=some-strong-password
Initialize the repository (first time only):
restic init
Create your first backup:
restic backup /etc/hosts
You can list all the snapshots you created with:
restic snapshots
You can restore a backup by noting the snapshot ID you want and running:
restic restore --target /tmp/some-target-dir your-snapshot-ID
It is a good idea to periodically check your repository's metadata:
restic check
# or full data:
restic check --read-data
The full documentation can be found at https://restic.readthedocs.io/
`
// cmdRoot is the base command when no other command has been specified. // cmdRoot is the base command when no other command has been specified.
var cmdRoot = &cobra.Command{ var cmdRoot = &cobra.Command{
Use: "restic", Use: "restic",
Short: "Backup and restore files", Short: "Backup and restore files",
Long: ` Long: LongDescription,
restic is a backup program which allows saving multiple revisions of files and
directories in an encrypted repository stored on different backends.
`,
SilenceErrors: true, SilenceErrors: true,
SilenceUsage: true, SilenceUsage: true,
DisableAutoGenTag: true, DisableAutoGenTag: true,