Skip to content

Commit

Permalink
fix: mark incremental flag in backup policy as required
Browse files Browse the repository at this point in the history
  • Loading branch information
lizzy-0323 committed Dec 17, 2024
1 parent f3bb57f commit 1b5ced9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/cli/backup/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,13 @@ func (o *CreateOptions) Validate() error {
if o.FullCrontab == "" {
return errors.New("Full backup schedule is required, at least one of the full schedule must be specified")
}
if o.IncrementalCrontab == "" {
return errors.New("Incremental backup schedule is required, at least one of the incremental schedule must be specified")
}
if !checkCrontabSyntax(o.FullCrontab) {
return errors.New("Invalid full backup schedule")
}
if o.IncrementalCrontab != "" && !checkCrontabSyntax(o.IncrementalCrontab) {
if !checkCrontabSyntax(o.IncrementalCrontab) {
return errors.New("Invalid incremental backup schedule")
}
return nil
Expand All @@ -212,6 +215,7 @@ func (o *CreateOptions) AddFlags(cmd *cobra.Command) {

func (o *CreateOptions) SetRequiredFlags(cmd *cobra.Command) {
_ = cmd.MarkFlagRequired(FLAG_FULL)
_ = cmd.MarkFlagRequired(FLAG_INCREMENTAL)
_ = cmd.MarkFlagRequired(FLAG_ARCHIVE_PATH)
_ = cmd.MarkFlagRequired(FLAG_BAK_DATA_PATH)
}
Expand Down

0 comments on commit 1b5ced9

Please sign in to comment.