Skip to content

Commit

Permalink
Include delete-subst command
Browse files Browse the repository at this point in the history
  • Loading branch information
phanimarupaka committed Aug 29, 2020
1 parent ff1b4d5 commit 2598790
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
12 changes: 11 additions & 1 deletion commands/configcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ func GetConfigCommand(name string) *cobra.Command {
deleteSetter.Long = cfgdocs.DeleteSetterShort + "\n" + cfgdocs.DeleteSetterLong
deleteSetter.Example = cfgdocs.DeleteSetterExamples

deleteSubstitution := DeleteSubstitutionCommand(name)
deleteSubstitution.Short = cfgdocs.DeleteSubstShort
deleteSubstitution.Long = cfgdocs.DeleteSubstShort + "\n" + cfgdocs.DeleteSubstLong
deleteSubstitution.Example = cfgdocs.DeleteSubstExamples

createSubstitution := CreateSubstCommand(name)
createSubstitution.Short = cfgdocs.CreateSubstShort
createSubstitution.Long = cfgdocs.CreateSubstShort + "\n" + cfgdocs.CreateSubstLong
Expand Down Expand Up @@ -100,7 +105,7 @@ func GetConfigCommand(name string) *cobra.Command {
tree.Long = cfgdocs.TreeShort + "\n" + cfgdocs.TreeLong
tree.Example = cfgdocs.TreeExamples

cfgCmd.AddCommand(an, cat, count, createSetter, deleteSetter, createSubstitution, fmt,
cfgCmd.AddCommand(an, cat, count, createSetter, deleteSetter, deleteSubstitution, createSubstitution, fmt,
grep, listSetters, set, tree)
return cfgCmd
}
Expand All @@ -115,6 +120,11 @@ func DeleteSetterCommand(parent string) *cobra.Command {
return configcobra.DeleteSetter(parent)
}

func DeleteSubstitutionCommand(parent string) *cobra.Command {
fieldmeta.SetShortHandRef(ShortHandRef)
return configcobra.DeleteSubstitution(parent)
}

func CreateSubstCommand(parent string) *cobra.Command {
fieldmeta.SetShortHandRef(ShortHandRef)
return configcobra.CreateSubstitution(parent)
Expand Down
6 changes: 3 additions & 3 deletions site/content/en/reference/cfg/delete-setter/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ linkTitle: "delete-setter"
weight: 4
type: docs
description: >
Delete a setter for one field
Delete a setter
---
<!--mdtogo:Short
Delete a setter for one field
Delete a setter
-->

{{< asciinema key="cfg-delete-setter" rows="10" preload="1" >}}
Expand All @@ -31,7 +31,7 @@ kpt cfg delete-setter DIR/ replicas
### Synopsis
<!--mdtogo:Long-->
```sh
kpt cfg delete-setter DIR NAME VALUE
kpt cfg delete-setter DIR NAME

DIR:
Path to a package directory
Expand Down
47 changes: 47 additions & 0 deletions site/content/en/reference/cfg/delete-subst/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: "Delete-subst"
linkTitle: "delete-subst"
weight: 4
type: docs
description: >
Delete a substitution
---
<!--mdtogo:Short
Delete a substitution
-->

Substitutions provide a solution for template-free substitution of field values
built on top of [setters]. They enable substituting values into part of a
field, including combining multiple setters into a single value.

See the [creating substitutions] guide for more info on creating
substitutions.

The created substitutions can be deleted using `delete-subst` command.

### Examples
<!--mdtogo:Examples-->
```sh
# delete a substitution image-tag
kpt cfg delete-subst DIR/ image-tag
```

<!--mdtogo-->

### Synopsis
<!--mdtogo:Long-->
```sh
kpt cfg delete-subst DIR NAME

DIR:
Path to a package directory

NAME:
The name of the substitution to delete. e.g. image-tag

```

<!--mdtogo-->

[setters]: ../create-setter/
[creating substitutions]: ../../../guides/producer/substitutions/

0 comments on commit 2598790

Please sign in to comment.