-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
stats.go
33 lines (28 loc) · 1.38 KB
/
stats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/restic_completer/cmd/action"
"github.com/spf13/cobra"
)
var statsCmd = &cobra.Command{
Use: "stats",
Short: "Scan the repository and show basic statistics",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(statsCmd).Standalone()
statsCmd.Flags().StringArrayP("host", "H", []string{}, "only consider snapshots with the given `host` (can be specified multiple times)")
statsCmd.Flags().String("mode", "restore-size", "counting mode: restore-size (default), files-by-contents, blobs-per-file or raw-data")
statsCmd.Flags().StringArray("path", []string{}, "only consider snapshots which include this (absolute) `path` (can be specified multiple times)")
statsCmd.Flags().StringSlice("tag", []string{}, "only consider snapshots which include this `taglist` in the format `tag[,tag,...]` (can be specified multiple times)")
rootCmd.AddCommand(statsCmd)
carapace.Gen(statsCmd).FlagCompletion(carapace.ActionMap{
"host": action.ActionSnapshotHosts(statsCmd),
"mode": carapace.ActionValues("restore-size", "files-by-contents", "blobs-per-file", "raw-data"),
"path": carapace.ActionFiles(),
"tag": action.ActionSnapshotTags(statsCmd).UniqueList(","),
})
carapace.Gen(statsCmd).PositionalAnyCompletion(
action.ActionSnapshotIDs(statsCmd).FilterArgs(),
)
}