Skip to content

Commit

Permalink
feat(cli): Add examples to projectwindows.go (argoproj#15860)
Browse files Browse the repository at this point in the history
* feat(cli): Add some examples to projectwindows.go

Signed-off-by: Joseph Perez <[email protected]>

* switch order of short and example

Signed-off-by: Joseph Perez <[email protected]>

* remove accidental add

Signed-off-by: Joseph Perez <[email protected]>

---------

Signed-off-by: Joseph Perez <[email protected]>
  • Loading branch information
josephperez3 authored and vladfr committed Dec 13, 2023
1 parent 7f9d0e5 commit 56e43ec
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
23 changes: 22 additions & 1 deletion cmd/argocd/commands/projectwindows.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ func NewProjectWindowsAddWindowCommand(clientOpts *argocdclient.ClientOptions) *
var command = &cobra.Command{
Use: "add PROJECT",
Short: "Add a sync window to a project",
Example: `# Add a 1 hour allow sync window
argocd proj windows add PROJECT \
--kind allow \
--schedule "0 22 * * *" \
--duration 1h \
--applications "*"
# Add a deny sync window with the ability to manually sync.
argocd proj windows add PROJECT \
--kind deny \
--schedule "30 10 * * *" \
--duration 30m \
--applications "prod-\\*,website" \
--namespaces "default,\\*-prod" \
--clusters "prod,staging" \
--manual-sync
`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down Expand Up @@ -158,7 +175,7 @@ func NewProjectWindowsAddWindowCommand(clientOpts *argocdclient.ClientOptions) *
return command
}

// NewProjectWindowsAddWindowCommand returns a new instance of an `argocd proj windows delete` command
// NewProjectWindowsDeleteCommand returns a new instance of an `argocd proj windows delete` command
func NewProjectWindowsDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "delete PROJECT ID",
Expand Down Expand Up @@ -205,6 +222,10 @@ func NewProjectWindowsUpdateCommand(clientOpts *argocdclient.ClientOptions) *cob
Use: "update PROJECT ID",
Short: "Update a project sync window",
Long: "Update a project sync window. Requires ID which can be found by running \"argocd proj windows list PROJECT\"",
Example: `# Change a sync window's schedule
argocd proj windows update PROJECT ID \
--schedule "0 20 * * *"
`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down
22 changes: 22 additions & 0 deletions docs/user-guide/commands/argocd_proj_windows_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ Add a sync window to a project
argocd proj windows add PROJECT [flags]
```

### Examples

```
# Add a 1 hour allow sync window
argocd proj windows add PROJECT \
--kind allow \
--schedule "0 22 * * *" \
--duration 1h \
--applications "*"
# Add a deny sync window with the ability to manually sync.
argocd proj windows add PROJECT \
--kind deny \
--schedule "30 10 * * *" \
--duration 30m \
--applications "prod-\\*,website" \
--namespaces "default,\\*-prod" \
--clusters "prod,staging" \
--manual-sync
```

### Options

```
Expand Down
9 changes: 9 additions & 0 deletions docs/user-guide/commands/argocd_proj_windows_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ Update a project sync window. Requires ID which can be found by running "argocd
argocd proj windows update PROJECT ID [flags]
```

### Examples

```
# Change a sync window's schedule
argocd proj windows update PROJECT ID \
--schedule "0 20 * * *"
```

### Options

```
Expand Down

0 comments on commit 56e43ec

Please sign in to comment.