diff --git a/cfg/cfg.go b/cfg/cfg.go index de9fee1..b79bdc3 100644 --- a/cfg/cfg.go +++ b/cfg/cfg.go @@ -8,6 +8,7 @@ import ( ) type AppSettings struct { + Force bool GrafanaURL string GrafanaToken string GitBranch string @@ -19,13 +20,14 @@ type AppSettings struct { } var cliStruct struct { + Force bool `name:"force" short:"f" help:"Force git commits / ignore existence check."` GrafanaURL string `name:"grafana-url" env:"GRAFANA_URL" help:"Grafana URL to access the API"` GrafanaToken string `name:"grafana-auth-token" env:"GRAFANA_AUTH_TOKEN" help:"Grafana auth token to access the API"` GitBranch string `name:"git-branch" env:"GIT_BRANCH" help:"Git branch name" default:"${default_git_branch}"` GitRepoURL string `name:"git-repo-url" env:"GIT_REPO_URL" help:"Complete Git repository URL"` GitUser string `name:"git-user" env:"GIT_USER" help:"Git username"` GitEmail string `name:"git-email" env:"GIT_EMAIL" help:"Git email address"` - GitPass string `name:"git-pass" env:"GIT_PASS" help:"Git password"` + GitPass string `name:"git-pass" env:"GIT_PASS" help:"Git user password"` GPGKey string `name:"signing-key" env:"GIT_SIGNING_KEY" help:"GPG signing key"` } @@ -42,6 +44,7 @@ func Parse() *AppSettings { validateFlags(ctx) settings := &AppSettings{ + Force: cliStruct.Force, GrafanaURL: cliStruct.GrafanaURL, GrafanaToken: cliStruct.GrafanaToken, GitBranch: cliStruct.GitBranch, diff --git a/main.go b/main.go index 064c5ef..72162df 100644 --- a/main.go +++ b/main.go @@ -52,7 +52,7 @@ func main() { for _, version := range versions { gitdata.UpdateVersion(version) - if gitdata.IsVersionCommitted(appSettings.GitBranch) { + if !appSettings.Force && gitdata.IsVersionCommitted(appSettings.GitBranch) { fmt.Printf("%s/%s - %s: %s -> already committed\n", dashboardInfo.FolderTitle, dashboard.Title, version.CreatedBy, version.Message) continue }