mirror of https://gitlab.com/gitlab-org/cli.git
refactor(release): update `release download` cmd to remove `external`
This commit is contained in:
parent
a6ed4bc441
commit
16b5614b39
|
@ -175,7 +175,6 @@ func TestReleaseCreateWithFiles(t *testing.T) {
|
|||
"name":"test_file.txt",
|
||||
"url":"https://gitlab.example.com/mynamespace/hello/-/jobs/688/artifacts/raw/fixtures/test_file.txt",
|
||||
"direct_asset_url":"https://gitlab.example.com/mynamespace/hello/-/releases/0.0.1/downloads/fixtures/test_file.txt",
|
||||
"external":false,
|
||||
"link_type":"other"
|
||||
}`)(req)
|
||||
return resp, nil
|
||||
|
|
|
@ -26,7 +26,6 @@ type DownloadOpts struct {
|
|||
Asset string
|
||||
AssetNames []string
|
||||
Dir string
|
||||
External bool
|
||||
|
||||
IO *iostreams.IOStreams
|
||||
HTTPClient func() (*gitlab.Client, error)
|
||||
|
@ -48,8 +47,6 @@ func NewCmdDownload(f *cmdutils.Factory, runE func(opts *DownloadOpts) error) *c
|
|||
If no tag is specified, assets are downloaded from the latest release.
|
||||
Use %[1]s--asset-name%[1]s to specify a file name to download from the release assets.
|
||||
%[1]s--asset-name%[1]s flag accepts glob patterns.
|
||||
|
||||
Unless %[1]s--include-external%[1]s flag is specified, external files are not downloaded.
|
||||
`, "`"),
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Example: heredoc.Doc(`
|
||||
|
@ -80,7 +77,6 @@ func NewCmdDownload(f *cmdutils.Factory, runE func(opts *DownloadOpts) error) *c
|
|||
|
||||
cmd.Flags().StringArrayVarP(&opts.AssetNames, "asset-name", "n", []string{}, "Download only assets that match the name or a glob pattern")
|
||||
cmd.Flags().StringVarP(&opts.Dir, "dir", "D", ".", "Directory to download the release assets to")
|
||||
cmd.Flags().BoolVarP(&opts.External, "include-external", "x", false, "Include external asset files")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
@ -130,9 +126,6 @@ func downloadRun(opts *DownloadOpts) error {
|
|||
}
|
||||
|
||||
for _, link := range release.Assets.Links {
|
||||
if link.External && !opts.External {
|
||||
continue
|
||||
}
|
||||
if len(opts.AssetNames) > 0 && (!matchAny(opts.AssetNames, link.Name)) {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -99,7 +99,6 @@ func TestReleaseUpload(t *testing.T) {
|
|||
"name":"test_file.txt",
|
||||
"url":"https://gitlab.example.com/mynamespace/hello/-/jobs/688/artifacts/raw/fixtures/test_file.txt",
|
||||
"direct_asset_url":"https://gitlab.example.com/mynamespace/hello/-/releases/0.0.1/downloads/fixtures/test_file.txt",
|
||||
"external":false,
|
||||
"link_type":"other"
|
||||
}`)(req)
|
||||
return resp, nil
|
||||
|
|
|
@ -55,9 +55,8 @@
|
|||
"name": "test asset",
|
||||
"url": "https://gitlab.com/some/location/1133",
|
||||
"direct_asset_url": "https://gitlab.com/OWNER/REPO/-/releases/0.0.1/downloads/test_asset",
|
||||
"external": true,
|
||||
"link_type": "other"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,9 +55,8 @@
|
|||
"name": "test asset",
|
||||
"url": "https://gitlab.com/some/location/1133",
|
||||
"direct_asset_url": "https://gitlab.com/OWNER/REPO/-/releases/0.0.1/downloads/test_asset",
|
||||
"external": true,
|
||||
"link_type": "other"
|
||||
}
|
||||
]
|
||||
}
|
||||
}]
|
||||
}]
|
||||
|
|
|
@ -21,8 +21,6 @@ If no tag is specified, assets are downloaded from the latest release.
|
|||
Use `--asset-name` to specify a file name to download from the release assets.
|
||||
`--asset-name` flag accepts glob patterns.
|
||||
|
||||
Unless `--include-external` flag is specified, external files are not downloaded.
|
||||
|
||||
```plaintext
|
||||
glab release download <tag> [flags]
|
||||
```
|
||||
|
@ -46,7 +44,6 @@ $ glab release download v1.10.1 --asset-name="*.tar.gz"
|
|||
```plaintext
|
||||
-n, --asset-name stringArray Download only assets that match the name or a glob pattern
|
||||
-D, --dir string Directory to download the release assets to (default ".")
|
||||
-x, --include-external Include external asset files
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
|
Loading…
Reference in New Issue