mirror of
https://github.com/kopia/kopia.git
synced 2026-09-08 11:26:03 -04:00
cli: restored snapshot create --hostname and --username flags
This commit is contained in:
1 parent
e3854f7773
commit
765bff8e0b
1 file changed
+11
-1
@@ -27,6 +27,8 @@
|
||||
snapshotCreateDescription = snapshotCreateCommand.Flag("description", "Free-form snapshot description.").String()
|
||||
snapshotCreateForceHash = snapshotCreateCommand.Flag("force-hash", "Force hashing of source files for a given percentage of files [0..100]").Default("0").Int()
|
||||
snapshotCreateParallelUploads = snapshotCreateCommand.Flag("parallel", "Upload N files in parallel").PlaceHolder("N").Default("0").Int()
|
||||
snapshotCreateHostname = snapshotCreateCommand.Flag("hostname", "Override local hostname.").String()
|
||||
snapshotCreateUsername = snapshotCreateCommand.Flag("username", "Override local username.").String()
|
||||
)
|
||||
|
||||
func runBackupCommand(ctx context.Context, rep *repo.Repository) error {
|
||||
@@ -76,6 +78,14 @@ func runBackupCommand(ctx context.Context, rep *repo.Repository) error {
|
||||
UserName: rep.Username,
|
||||
}
|
||||
|
||||
if h := *snapshotCreateHostname; h != "" {
|
||||
sourceInfo.Host = h
|
||||
}
|
||||
|
||||
if u := *snapshotCreateUsername; u != "" {
|
||||
sourceInfo.UserName = u
|
||||
}
|
||||
|
||||
if err := snapshotSingleSource(ctx, rep, u, sourceInfo); err != nil {
|
||||
finalErrors = append(finalErrors, err.Error())
|
||||
}
|
||||
@@ -89,7 +99,7 @@ func runBackupCommand(ctx context.Context, rep *repo.Repository) error {
|
||||
}
|
||||
|
||||
func snapshotSingleSource(ctx context.Context, rep *repo.Repository, u *snapshotfs.Uploader, sourceInfo snapshot.SourceInfo) error {
|
||||
printStdout("Snapshotting %v ...\n", sourceInfo)
|
||||
printStderr("Snapshotting %v ...\n", sourceInfo)
|
||||
|
||||
t0 := time.Now()
|
||||
|
||||
|
||||
Reference in new issue
Block a user