Skip to content

Commit 80c3875

Browse files
committed
change(uploader): add --no-check to skip checks and force uploaders to run
1 parent 610a5e2 commit 80c3875

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

cmd/sync.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
var (
1515
flagSyncer string
1616
)
17+
1718
var syncCmd = &cobra.Command{
1819
Use: "sync",
1920
Short: "Perform syncer task(s)",

cmd/upload.go

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import (
1111
"strings"
1212
)
1313

14+
var (
15+
flagNoCheck bool
16+
)
17+
1418
var uploadCmd = &cobra.Command{
1519
Use: "upload",
1620
Short: "Perform uploader task(s)",
@@ -79,12 +83,15 @@ var uploadCmd = &cobra.Command{
7983
}
8084

8185
// check if upload criteria met
82-
if shouldUpload, err := upload.Check(); err != nil {
83-
upload.Log.WithError(err).Error("Failed checking if uploader check conditions met, skipping...")
84-
continue
85-
} else if !shouldUpload {
86-
upload.Log.Info("Upload conditions not met, skipping...")
87-
continue
86+
if !flagNoCheck {
87+
// no check was not enabled
88+
if shouldUpload, err := upload.Check(); err != nil {
89+
upload.Log.WithError(err).Error("Failed checking if uploader check conditions met, skipping...")
90+
continue
91+
} else if !shouldUpload {
92+
upload.Log.Info("Upload conditions not met, skipping...")
93+
continue
94+
}
8895
}
8996

9097
// perform upload
@@ -100,6 +107,8 @@ func init() {
100107
rootCmd.AddCommand(uploadCmd)
101108

102109
uploadCmd.Flags().StringVarP(&flagUploader, "uploader", "u", "", "Run for a specific uploader")
110+
111+
uploadCmd.Flags().BoolVar(&flagNoCheck, "no-check", false, "Ignore check and run")
103112
}
104113

105114
func performUpload(u *uploader.Uploader) error {
@@ -114,7 +123,11 @@ func performUpload(u *uploader.Uploader) error {
114123
}
115124

116125
/* Generate Additional Rclone Params */
117-
additionalRcloneParams := u.CheckRcloneParams()
126+
var additionalRcloneParams []string
127+
128+
if !flagNoCheck {
129+
additionalRcloneParams = u.CheckRcloneParams()
130+
}
118131

119132
/* Copies */
120133
if len(u.Config.Remotes.Copy) > 0 {

0 commit comments

Comments
 (0)