cli: restored snapshot create --hostname and --username flags
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()
