first commit
This commit is contained in:
24
Commands/BackupCommand.cs
Normal file
24
Commands/BackupCommand.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using HanaToolbox.Cli;
|
||||
using HanaToolbox.Config;
|
||||
using HanaToolbox.Logging;
|
||||
using HanaToolbox.Services;
|
||||
|
||||
namespace HanaToolbox.Commands;
|
||||
|
||||
public static class BackupCommand
|
||||
{
|
||||
public static async Task<int> RunAsync(CliArgs cli)
|
||||
{
|
||||
var log = new AppLogger(cli.Verbose);
|
||||
try
|
||||
{
|
||||
var config = ConfigService.Load();
|
||||
var sid = string.IsNullOrWhiteSpace(cli.Sid) ? config.Hana.Sid : cli.Sid;
|
||||
log.Step($"Starting backup (SID: {sid})...");
|
||||
await ServiceFactory.CreateBackupService(log)
|
||||
.RunAsync(config.Backup, config.Hana, sid);
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex) { log.Error(ex.Message); return 1; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user