Browse code

Give user suggestion about new-app on new-project

Don't assume they know about it.

Clayton Coleman authored on 2015/12/12 08:03:44
Showing 2 changed files
... ...
@@ -71,7 +71,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *
71 71
 			Commands: []*cobra.Command{
72 72
 				cmd.NewCmdTypes(fullName, f, out),
73 73
 				loginCmd,
74
-				cmd.NewCmdRequestProject("new-project", fullName+" new-project", fullName+" login", fullName+" project", f, out),
74
+				cmd.NewCmdRequestProject(fullName, "new-project", fullName+" login", fullName+" project", f, out),
75 75
 				cmd.NewCmdNewApplication(fullName, f, out),
76 76
 				cmd.NewCmdStatus(cmd.StatusRecommendedName, fullName+" "+cmd.StatusRecommendedName, f, out),
77 77
 				cmd.NewCmdProject(fullName+" project", f, out),
... ...
@@ -22,6 +22,8 @@ type NewProjectOptions struct {
22 22
 	DisplayName string
23 23
 	Description string
24 24
 
25
+	Name string
26
+
25 27
 	Client client.Interface
26 28
 
27 29
 	ProjectOptions *ProjectOptions
... ...
@@ -32,11 +34,10 @@ const (
32 32
 	requestProjectLong = `
33 33
 Create a new project for yourself
34 34
 
35
-Assuming your cluster admin has granted you permission, this command will create a new project
36
-for you and assign you as the project admin. If your administrator has not given you permission to
37
-create your own projects, contact your system administrator.
35
+If your administrator allows self-service, this command will create a new project for you and assign you
36
+as the project admin.
38 37
 
39
-After your project is created it will be made your default project in your config.`
38
+After your project is created it will become the default project in your config.`
40 39
 
41 40
 	requestProjectExample = `  # Create a new project with minimal information
42 41
   $ %[1]s web-team-dev
... ...
@@ -45,9 +46,11 @@ After your project is created it will be made your default project in your confi
45 45
   $ %[1]s web-team-dev --display-name="Web Team Development" --description="Development project for the web team."`
46 46
 )
47 47
 
48
-func NewCmdRequestProject(name, fullName, ocLoginName, ocProjectName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
48
+func NewCmdRequestProject(baseName, name, ocLoginName, ocProjectName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
49 49
 	options := &NewProjectOptions{}
50 50
 	options.Out = out
51
+	options.Name = baseName
52
+	fullName := fmt.Sprintf("%s %s", baseName, name)
51 53
 
52 54
 	cmd := &cobra.Command{
53 55
 		Use:     fmt.Sprintf("%s NAME [--display-name=DISPLAYNAME] [--description=DESCRIPTION]", name),
... ...
@@ -121,5 +124,13 @@ func (o *NewProjectOptions) Run() error {
121 121
 		}
122 122
 	}
123 123
 
124
+	fmt.Fprintf(o.Out, `
125
+You can add applications to this project with the 'new-app' command. For example, try:
126
+
127
+    $ %[1]s new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-hello-world.git
128
+
129
+to build a new hello-world application in Ruby.
130
+`, o.Name)
131
+
124 132
 	return nil
125 133
 }