Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions cf/commands/application/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ func (cmd *Files) Metadata() command_metadata.CommandMetadata {
Name: "files",
ShortName: "f",
Description: T("Print out a list of files in a directory or the contents of a specific file"),
Usage: T("CF_NAME files APP [-i INSTANCE] [PATH]"),
Usage: T("CF_NAME files APP PATH [-i INSTANCE]"),
Flags: []cli.Flag{
flag_helpers.NewIntFlag("i", T("Instance")),
},
}
}

func (cmd *Files) GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) {
if len(c.Args()) < 1 {
if len(c.Args()) != 2 {
cmd.ui.FailWithUsage(c)
}

Expand Down Expand Up @@ -81,10 +81,7 @@ func (cmd *Files) Run(c *cli.Context) {
"SpaceName": terminal.EntityNameColor(cmd.config.SpaceFields().Name),
"Username": terminal.EntityNameColor(cmd.config.Username())}))

path := "/"
if len(c.Args()) > 1 {
path = c.Args()[1]
}
path := c.Args()[1]

list, apiErr := cmd.appFilesRepo.ListFiles(app.Guid, instance, path)
if apiErr != nil {
Expand Down
8 changes: 4 additions & 4 deletions cf/commands/application/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var _ = Describe("files command", func() {
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
})

It("fails with usage when not provided an app name", func() {
It("fails with usage when not provided exact num of args", func() {
requirementsFactory.LoginSuccess = true
requirementsFactory.TargetedSpaceSuccess = true
runCommand()
Expand All @@ -56,7 +56,7 @@ var _ = Describe("files command", func() {
})
})

Context("when logged in, a space is targeted and a valid app name is provided", func() {
Context("when logged in, a space is targeted and a valid app name and path are provided", func() {
BeforeEach(func() {
app := models.Application{}
app.Name = "my-found-app"
Expand Down Expand Up @@ -92,7 +92,7 @@ var _ = Describe("files command", func() {

Context("checking for bad flags", func() {
It("fails when non-positive value is given for instance", func() {
runCommand("-i", "-1", "my-app")
runCommand("-i", "-1", "my-app", "/foo")

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
Expand All @@ -102,7 +102,7 @@ var _ = Describe("files command", func() {
})

It("fails when instance is larger than instance count", func() {
runCommand("-i", "5", "my-app")
runCommand("-i", "5", "my-app", "/foo")

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/de_DE.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files APP [PATH]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files APP PATH [-i INSTANCE]",
"modified": true
},
{
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/en_US.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files APP [-i INSTANCE] [PATH]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files APP PATH [-i INSTANCE]",
"modified": false
},
{
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/es_ES.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files APP [PATH]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files APP PATH [-i INSTANCE]",
"modified": true
},
{
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/fr_FR.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files APP [PATH]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files APP PATH [-i INSTANCE]",
"modified": true
},
{
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/it_IT.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files APP [PATH]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files APP PATH [-i INSTANCE]",
"modified": true
},
{
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/ja_JA.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files APP [PATH]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files APP PATH [-i INSTANCE]",
"modified": true
},
{
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/pt_BR.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files APP [-i INSTÂNCIA] [CAMINHO]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files APP CAMINHO [-i INSTÂNCIA]",
"modified": true
},
{
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/zh_Hans.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files 应用程序名 [路径]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files 路径 应用程序名",
"modified": true
},
{
Expand Down
4 changes: 2 additions & 2 deletions cf/i18n/resources/zh_Hant.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,8 @@
"modified": false
},
{
"id": "CF_NAME files APP [-i INSTANCE] [PATH]",
"translation": "CF_NAME files APP [PATH]",
"id": "CF_NAME files APP PATH [-i INSTANCE]",
"translation": "CF_NAME files APP PATH [-i INSTANCE]",
"modified": true
},
{
Expand Down