Skip to content

Commit

Permalink
set dot a default for argo app commands
Browse files Browse the repository at this point in the history
Signed-off-by: Prune <[email protected]>
  • Loading branch information
prune998 committed Feb 6, 2024
1 parent 61caddb commit 2cccbc9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
13 changes: 3 additions & 10 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1117,15 +1117,8 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
cluster, err := clusterIf.Get(ctx, &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server})
errors.CheckError(err)

if localRepoRoot == "" {
localDirectory, err := os.Getwd() //get the current directory using the built-in function
errors.CheckError(err)
diffOption.localRepoRoot = localDirectory
} else {
diffOption.localRepoRoot = localRepoRoot
}

diffOption.local = local
diffOption.localRepoRoot = localRepoRoot
diffOption.cluster = cluster
}
}
Expand All @@ -1141,7 +1134,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
command.Flags().BoolVar(&exitCode, "exit-code", true, "Return non-zero exit code when there is a diff")
command.Flags().StringVar(&local, "local", "", "Compare live app to a local manifests")
command.Flags().StringVar(&revision, "revision", "", "Compare live app to a particular revision")
command.Flags().StringVar(&localRepoRoot, "local-repo-root", "", "Path to the repository root. Used together with --local allows setting the repository root")
command.Flags().StringVar(&localRepoRoot, "local-repo-root", ".", "Path to the repository root. Used together with --local allows setting the repository root")
command.Flags().BoolVar(&serverSideGenerate, "server-side-generate", false, "Used with --local, this will send your manifests to the server for diffing")
command.Flags().StringArrayVar(&localIncludes, "local-include", []string{"*.yaml", "*.yml", "*.json"}, "Used with --server-side-generate, specify patterns of filenames to send. Matching is based on filename and not path.")
return command
Expand Down Expand Up @@ -1982,7 +1975,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
command.Flags().BoolVar(&applyOutOfSyncOnly, "apply-out-of-sync-only", false, "Sync only out-of-sync resources")
command.Flags().BoolVar(&async, "async", false, "Do not wait for application to sync before continuing")
command.Flags().StringVar(&local, "local", "", "Path to a local directory. When this flag is present no git queries will be made")
command.Flags().StringVar(&localRepoRoot, "local-repo-root", "/", "Path to the repository root. Used together with --local allows setting the repository root")
command.Flags().StringVar(&localRepoRoot, "local-repo-root", ".", "Path to the repository root. Used together with --local allows setting the repository root")
command.Flags().StringArrayVar(&infos, "info", []string{}, "A list of key-value pairs during sync process. These infos will be persisted in app.")
command.Flags().BoolVar(&diffChangesConfirm, "assumeYes", false, "Assume yes as answer for all user queries or prompts")
command.Flags().BoolVar(&diffChanges, "preview-changes", false, "Preview difference against the target and live state before syncing app and wait for user confirmation")
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_app_diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ argocd app diff APPNAME [flags]
-h, --help help for diff
--local string Compare live app to a local manifests
--local-include stringArray Used with --server-side-generate, specify patterns of filenames to send. Matching is based on filename and not path. (default [*.yaml,*.yml,*.json])
--local-repo-root string Path to the repository root. Used together with --local allows setting the repository root (default "/")
--local-repo-root string Path to the repository root. Used together with --local allows setting the repository root (default ".")
--refresh Refresh application data when retrieving
--revision string Compare live app to a particular revision
--server-side-generate Used with --local, this will send your manifests to the server for diffing
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_app_sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ argocd app sync [APPNAME... | -l selector | --project project-name] [flags]
--info stringArray A list of key-value pairs during sync process. These infos will be persisted in app.
--label stringArray Sync only specific resources with a label. This option may be specified repeatedly.
--local string Path to a local directory. When this flag is present no git queries will be made
--local-repo-root string Path to the repository root. Used together with --local allows setting the repository root (default "/")
--local-repo-root string Path to the repository root. Used together with --local allows setting the repository root (default ".")
-o, --output string Output format. One of: json|yaml|wide|tree|tree=detailed (default "wide")
--preview-changes Preview difference against the target and live state before syncing app and wait for user confirmation
--project stringArray Sync apps that belong to the specified projects. This option may be specified repeatedly.
Expand Down

0 comments on commit 2cccbc9

Please sign in to comment.