Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8edf515

Browse files
authored
Merge pull request#660 from symfony-cli/deploy-cmd-fix
Wrap the deploy Cloud command to warn about the command name ambiguity
2 parentsf288f0e +d1dfecf commit8edf515

File tree

5 files changed

+66
-4
lines changed

5 files changed

+66
-4
lines changed

‎commands/root.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func CommonCommands() []*console.Command {
8383
projectLocalRabbitMQManagementOpenCmd,
8484
projectLocalServiceOpenCmd,
8585
projectLocalOpenCmd,
86+
upsunDeployCmd,
8687
}
8788
returnappend(localCommands,adminCommands...)
8889
}

‎commands/upsun_deploy.go‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2025-present Fabien Potencier <fabien@symfony.com>
3+
*
4+
* This file is part of Symfony CLI project
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
package commands
21+
22+
import (
23+
"os"
24+
25+
"github.com/symfony-cli/console"
26+
"github.com/symfony-cli/symfony-cli/local/upsun"
27+
"github.com/symfony-cli/terminal"
28+
)
29+
30+
varupsunDeployCmd=&console.Command{
31+
Category:"cloud",
32+
Name:"deploy",
33+
Aliases: []*console.Alias{{Name:"upsun:deploy",Hidden:true}, {Name:"deploy",Hidden:true}},
34+
Hidden:console.Hide,
35+
Flags:func() []console.Flag {
36+
for_,cmd:=rangeupsun.Commands {
37+
ifcmd.Category=="cloud:environment"&&cmd.Name=="push" {
38+
returncmd.Flags
39+
}
40+
}
41+
return []console.Flag{}
42+
}(),
43+
Action:func(c*console.Context)error {
44+
terminal.Printf(`<warning> /////////////// WARNING \\\\\\\\\\\\\\\ </>
45+
The <info>%s</> command is ambiguous.
46+
47+
You should use <info>env:push</> or <info>env:deploy</> instead.
48+
49+
Historically, the <comment>%s</> command was an alias for <comment>env:push</> on Symfony Cloud.
50+
But Upsun (formerly Platform.sh) now has an <comment>env:deploy</> command.
51+
52+
To deploy your application like before, use <comment>env:push</>.
53+
Or <href=https://docs.upsun.com/administration/cli/reference.html#environmentdeploy>read</> about the new <comment>env:deploy</> command.
54+
<warning> /////////////// WARNING \\\\\\\\\\\\\\\ </>
55+
56+
`,c.Command.FullName(),c.Command.FullName(),
57+
)
58+
os.Args[1]="cloud:environment:push"
59+
returnc.App.Run(os.Args)
60+
},
61+
}

‎local/upsun/cli.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (p *CLI) WrapHelpPrinter() func(w io.Writer, templ string, data interface{}
201201
returnfunc(w io.Writer,templstring,datainterface{}) {
202202
switchcmd:=data.(type) {
203203
case*console.Command:
204-
ifstrings.HasPrefix(cmd.Category,"cloud") {
204+
ifstrings.HasPrefix(cmd.Category,"cloud")&&cmd.FullName()!="cloud:deploy"{
205205
brand:=GuessCloudFromCommandName(cmd.UserName)
206206
cmd:=p.executor(brand, []string{cmd.FullName(),"--help"})
207207
cmd.Run()

‎local/upsun/commands.go‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎local/upsun/generator/commands.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ func parseCommands(cloudPath string) (string, error) {
167167
}
168168
aliases=append(aliases,fmt.Sprintf("{Name:\"upsun:%s\", Hidden: true}",command.Name))
169169
for_,alias:=rangecmdAliases {
170+
ifalias=="deploy" {
171+
continue
172+
}
170173
aliases=append(aliases,fmt.Sprintf("{Name:\"cloud:%s\"}",alias))
171174
aliases=append(aliases,fmt.Sprintf("{Name:\"upsun:%s\", Hidden: true}",alias))
172175
ifnamespace!="cloud"&&!strings.HasPrefix(command.Name,"self:") {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp