style(Naming): Renamed Command funcs correctly
This commit is contained in:
parent
0c039d08f9
commit
9d51a9e5e6
3 changed files with 44 additions and 41 deletions
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"scabiosa/Tools"
|
"scabiosa/Tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GenerateNewConfigs() *cli.Command {
|
func GenerateNewConfigsCommand() *cli.Command {
|
||||||
logger := Logging.Logger("generate-configs")
|
logger := Logging.Logger("generate-configs")
|
||||||
|
|
||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func StartBackupProc() *cli.Command {
|
func StartBackupProcCommand() *cli.Command {
|
||||||
logger := Logging.Logger("backup")
|
logger := Logging.Logger("backup")
|
||||||
|
|
||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
|
|
@ -21,6 +21,19 @@ func StartBackupProc() *cli.Command {
|
||||||
Description: "Compresses and uploads/stores the backups",
|
Description: "Compresses and uploads/stores the backups",
|
||||||
HelpName: "backup",
|
HelpName: "backup",
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
|
StartBackupProc()
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
OnUsageError: func(cc *cli.Context, err error, isSubcommand bool) error {
|
||||||
|
if err != nil {
|
||||||
|
logger.Fatal(err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func StartBackupProc() {
|
||||||
Tools.CheckIfConfigExists()
|
Tools.CheckIfConfigExists()
|
||||||
config := Tools.GetConfig()
|
config := Tools.GetConfig()
|
||||||
|
|
||||||
|
|
@ -57,16 +70,6 @@ func StartBackupProc() *cli.Command {
|
||||||
}
|
}
|
||||||
SQL.NewBackupEntry(SQL.GetSQLInstance(), backupItem.BackupName, time.Now(), backupItem.CreateLocalBackup, backupItem.FolderPath, StorageTypes.CheckRemoteStorageType(backupItem.RemoteStorageType), backupItem.RemoteTargetPath, backupItem.LocalTargetPath)
|
SQL.NewBackupEntry(SQL.GetSQLInstance(), backupItem.BackupName, time.Now(), backupItem.CreateLocalBackup, backupItem.FolderPath, StorageTypes.CheckRemoteStorageType(backupItem.RemoteStorageType), backupItem.RemoteTargetPath, backupItem.LocalTargetPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
OnUsageError: func(cc *cli.Context, err error, isSubcommand bool) error {
|
|
||||||
if err != nil {
|
|
||||||
logger.Fatal(err)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTimeSuffix() string {
|
func getTimeSuffix() string {
|
||||||
|
|
|
||||||
4
main.go
4
main.go
|
|
@ -21,8 +21,8 @@ func main() {
|
||||||
},
|
},
|
||||||
Copyright: "(c) 2021-2022 netbenix",
|
Copyright: "(c) 2021-2022 netbenix",
|
||||||
Commands: []*cli.Command{
|
Commands: []*cli.Command{
|
||||||
Commands.StartBackupProc(),
|
Commands.StartBackupProcCommand(),
|
||||||
Commands.GenerateNewConfigs(),
|
Commands.GenerateNewConfigsCommand(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue