Update component create and delete help examples (#4904)

* Update component create and delete examples in the help doc

* Enhance help messages

* Enhance flag messages
This commit is contained in:
Parthvi Vala
2021-07-19 11:50:53 +05:30
committed by GitHub
parent 9237d8d21f
commit 6f198cb7fa
3 changed files with 38 additions and 10 deletions

View File

@@ -10,6 +10,17 @@
### Documentation
## 2.2.x
### Feature/Enhancements
### Bug Fixes
- Fix component create and delete help examples([#4904](https://github.com/openshift/odo/pull/4904))
### Tests
### Documentation
## 2.2.3
### Feature/Enhancements

View File

@@ -115,14 +115,17 @@ odo catalog list components
# Create new Node.js component named 'frontend' with the source in './frontend' directory
%[1]s nodejs frontend --context ./frontend
# Create new Java component with binary named sample.jar in './target' directory
%[1]s java:8 --binary target/sample.jar
# Create new Java component with binary named sample.jar in './target' directory; this flag is specific to S2I
%[1]s java:8 --s2i --binary target/sample.jar
# Create new Node.js component with source from remote git repository
%[1]s nodejs --git https://github.com/openshift/nodejs-ex.git
# Create new Node.js component with source from remote git repository; this flag is specific to S2I
%[1]s nodejs --s2i --git https://github.com/openshift/nodejs-ex.git
# Create new Node.js component with custom ports and environment variables
%[1]s nodejs --port 8080,8100/tcp,9100/udp --env key=value,key1=value1`)
%[1]s nodejs --port 8080,8100/tcp,9100/udp --env key=value,key1=value1
# Create a new Node.js component that is a part of 'myapp' app inside the 'myproject' project
%[1]s nodejs --app myapp --project myproject`)
const defaultStarterProjectName = "devfile-starter-project-name"
@@ -1022,8 +1025,8 @@ func NewCmdCreate(name, fullName string) *cobra.Command {
genericclioptions.GenericRun(co, cmd, args)
},
}
componentCreateCmd.Flags().StringVarP(&co.componentBinary, "binary", "b", "", "Create a binary file component component using given artifact. Works only with Java components. File needs to be in the context directory.")
componentCreateCmd.Flags().StringVarP(&co.componentGit, "git", "g", "", "Create a git component using this repository.")
componentCreateCmd.Flags().StringVarP(&co.componentBinary, "binary", "b", "", "Create a binary file component component using given artifact. Works only with Java components. File needs to be in the context directory. Specific to S2I components.")
componentCreateCmd.Flags().StringVarP(&co.componentGit, "git", "g", "", "Create a git component using this repository. Specific to S2I components.")
componentCreateCmd.Flags().StringVarP(&co.componentGitRef, "ref", "r", "", "Use a specific ref e.g. commit, branch or tag of the git repository (only valid for --git components)")
genericclioptions.AddContextFlag(componentCreateCmd, &co.componentContext)
componentCreateCmd.Flags().StringSliceVarP(&co.componentPorts, "port", "p", []string{}, "Ports to be used when the component is created (ex. 8080,8100/tcp,9100/udp)")

View File

@@ -28,10 +28,24 @@ import (
// DeleteRecommendedCommandName is the recommended delete command name
const DeleteRecommendedCommandName = "delete"
var deleteExample = ktemplates.Examples(` # Delete component named 'frontend'.
var deleteExample = ktemplates.Examples(`
# Delete the component present in the current directory from the cluster
%[1]s
# Delete the component named 'frontend' from the cluster
%[1]s frontend
%[1]s frontend --all
`)
# Delete the component present in the current directory from the cluster and all of its related local config files("devfile.yaml" and ".odo" directory)
%[1]s --all
# Delete the component present in the './frontend' directory from the cluster
%[1]s --context ./frontend
# Delete the component present in the './frontend' directory from the cluster and all of its related local config files("devfile.yaml" and ".odo" directory)
%[1]s --context ./frontend --all
# Delete the component 'frontend' that is a part of 'myapp' app inside the 'myproject' project from the cluster
%[1]s frontend --app myapp --project myproject`)
// DeleteOptions is a container to attach complete, validate and run pattern
type DeleteOptions struct {