Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: add aliases for userfile commands and switch ls to list #53074

Merged
merged 1 commit into from
Aug 21, 2020
Merged
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
12 changes: 7 additions & 5 deletions pkg/cli/userfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ Uploads a file to the user scoped file storage using a SQL connection.
}

var userFileListCmd = &cobra.Command{
Use: "ls <file|dir glob>",
Use: "list <file|dir glob>",
Short: "list files matching the provided pattern",
Long: `
Lists the files stored in the user scoped file storage which match the provided pattern,
using a SQL connection. If no pattern is provided, all files in the specified
(or default, if unspecified) user scoped file storage will be listed.
`,
Args: cobra.MinimumNArgs(0),
RunE: maybeShoutError(runUserFileList),
Args: cobra.MinimumNArgs(0),
RunE: maybeShoutError(runUserFileList),
Aliases: []string{"ls"},
}

var userFileDeleteCmd = &cobra.Command{
Expand All @@ -63,8 +64,9 @@ using a SQL connection. If passed pattern '*', all files in the specified
(or default, if unspecified) user scoped file storage will be deleted. Deletions are not
atomic, and all deletions prior to the first failure will occur.
`,
Args: cobra.MinimumNArgs(1),
RunE: maybeShoutError(runUserFileDelete),
Args: cobra.MinimumNArgs(1),
RunE: maybeShoutError(runUserFileDelete),
Aliases: []string{"rm"},
}

func runUserFileDelete(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/userfiletable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func TestUserFileUpload(t *testing.T) {
}

func checkListedFiles(t *testing.T, c cliTest, uri string, expectedFiles []string) {
cliOutput, err := c.RunWithCaptureArgs([]string{"userfile", "ls", uri})
cliOutput, err := c.RunWithCaptureArgs([]string{"userfile", "list", uri})
require.NoError(t, err)
cliOutput = strings.TrimSpace(cliOutput)

Expand Down