Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ func run(cfg *Config) error {
statsInfo,
selectionInfo,
cfg.ArgocdUIURL,
cfg.SummaryThreshold,
cfg.IgnoreResourceRules,
)
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions cmd/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var (
DefaultKindInternal = false
DefaultK3dOptions = ""
DefaultMaxDiffLength = uint(65536)
DefaultSummaryThreshold = uint(20)
DefaultArgocdNamespace = "argocd"
DefaultArgocdChartVersion = "latest"
DefaultArgocdChartName = "argo"
Expand Down Expand Up @@ -105,6 +106,7 @@ type RawOptions struct {
KindInternal bool `mapstructure:"kind-internal"`
K3dOptions string `mapstructure:"k3d-options"`
MaxDiffLength uint `mapstructure:"max-diff-length"`
SummaryThreshold uint `mapstructure:"summary-threshold"`
Selector string `mapstructure:"selector"`
FilesChanged string `mapstructure:"files-changed"`
IgnoreInvalidWatchPattern bool `mapstructure:"ignore-invalid-watch-pattern"`
Expand Down Expand Up @@ -153,6 +155,7 @@ type Config struct {
KindInternal bool
K3dOptions string
MaxDiffLength uint
SummaryThreshold uint
IgnoreInvalidWatchPattern bool
WatchIfNoWatchPatternFound bool
AutoDetectFilesChanged bool
Expand Down Expand Up @@ -252,6 +255,7 @@ func Parse() *Config {
viper.SetDefault("cluster", DefaultCluster)
viper.SetDefault("cluster-name", DefaultClusterName)
viper.SetDefault("max-diff-length", DefaultMaxDiffLength)
viper.SetDefault("summary-threshold", DefaultSummaryThreshold)
viper.SetDefault("argocd-namespace", DefaultArgocdNamespace)
viper.SetDefault("argocd-chart-version", DefaultArgocdChartVersion)
viper.SetDefault("argocd-chart-name", DefaultArgocdChartName)
Expand Down Expand Up @@ -318,6 +322,7 @@ func Parse() *Config {

// Other options
rootCmd.Flags().String("max-diff-length", fmt.Sprintf("%d", DefaultMaxDiffLength), "Max diff message character count")
rootCmd.Flags().Uint("summary-threshold", DefaultSummaryThreshold, "Collapse summary details when total changed applications exceed this value (0 = always show inline)")
rootCmd.Flags().StringP("selector", "l", "", "Label selector to filter on (e.g. key1=value1,key2=value2)")
rootCmd.Flags().String("files-changed", "", "List of files changed between branches (comma, space or newline separated)")
rootCmd.Flags().Bool("auto-detect-files-changed", DefaultAutoDetectFilesChanged, "Auto detect files changed between branches")
Expand Down Expand Up @@ -394,6 +399,7 @@ func (o *RawOptions) ToConfig() (*Config, error) {
KindInternal: o.KindInternal,
K3dOptions: o.K3dOptions,
MaxDiffLength: o.MaxDiffLength,
SummaryThreshold: o.SummaryThreshold,
IgnoreInvalidWatchPattern: o.IgnoreInvalidWatchPattern,
WatchIfNoWatchPatternFound: o.WatchIfNoWatchPatternFound,
AutoDetectFilesChanged: o.AutoDetectFilesChanged,
Expand Down Expand Up @@ -671,6 +677,9 @@ func (o *Config) LogConfig() {
if o.MaxDiffLength != DefaultMaxDiffLength {
log.Info().Msgf("✨ - max-diff-length: %d", o.MaxDiffLength)
}
if o.SummaryThreshold != DefaultSummaryThreshold {
log.Info().Msgf("✨ - summary-threshold: %d", o.SummaryThreshold)
}
if len(o.FilesChanged) > 0 {
log.Info().Msgf("✨ - files-changed: %v", o.FilesChanged)
} else if o.AutoDetectFilesChanged {
Expand Down
1 change: 1 addition & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ argocd-diff-preview [FLAGS] [OPTIONS] --repo <repo> --target-branch <target-bran
| `--line-count <count>`, `-c` | `LINE_COUNT` | `5` | Generate diffs with \<n\> lines of context |
| `--log-format <format>` | `LOG_FORMAT` | `human` | Log format. Options: `human`, `json` |
| `--max-diff-length <length>` | `MAX_DIFF_LENGTH` | `65536` | Max diff message character count (only limits the generated Markdown file) |
| `--summary-threshold <count>` | `SUMMARY_THRESHOLD` | `20` | Collapse summary details when total changed applications exceed this value (`0` = always show inline) |
| `--output-folder <folder>`, `-o` | `OUTPUT_FOLDER` | `./output` | Output folder where the diff will be saved |
| `--redirect-target-revisions <revs>` | `REDIRECT_TARGET_REVISIONS` | - | List of target revisions to redirect |
| `--render-method <method>` | `RENDER_METHOD` | `server-api` | Manifest rendering method. Options: `cli`, `server-api`, `repo-server-api` |
Expand Down
Loading
Loading