Files
kopia/cli/command_snapshot.go
Jarek Kowalski d2288c443f cli: major refactoring (#1046)
cli: major refactoring of how CLI commands are registered

The goal is to eliminate flags as global variables to allow for better
testing. Each command and subcommand and most sets of flags are now
their own struct with 'setup()' methods that attached the flags or
subcommand to the provided parent.

This change is 94.3% mechanical, but is fully organic and hand-made.

* introduced cli.appServices interface which provides the environment in which commands run
* remove auto-maintenance global flag
* removed globals in memory_tracking.go
* removed globals from cli_progress.go
* removed globals from the update_check.go
* moved configPath into TheApp
* removed remaining globals from config.go
* refactored logfile to get rid of global variables
* removed 'app' global variable
* linter fixes
* fixed password_*.go build
* fixed BSD build
2021-05-03 10:28:00 -07:00

31 lines
923 B
Go

package cli
type commandSnapshot struct {
copyHistory commandSnapshotCopyMoveHistory
moveHistory commandSnapshotCopyMoveHistory
create commandSnapshotCreate
delete commandSnapshotDelete
estimate commandSnapshotEstimate
expire commandSnapshotExpire
gc commandSnapshotGC
list commandSnapshotList
migrate commandSnapshotMigrate
restore commandSnapshotRestore
verify commandSnapshotVerify
}
func (c *commandSnapshot) setup(svc advancedAppServices, parent commandParent) {
cmd := parent.Command("snapshot", "Commands to manipulate snapshots.").Alias("snap")
c.copyHistory.setup(svc, cmd, false)
c.moveHistory.setup(svc, cmd, true)
c.create.setup(svc, cmd)
c.delete.setup(svc, cmd)
c.estimate.setup(svc, cmd)
c.expire.setup(svc, cmd)
c.gc.setup(svc, cmd)
c.list.setup(svc, cmd)
c.migrate.setup(svc, cmd)
c.restore.setup(svc, cmd)
c.verify.setup(svc, cmd)
}