Skip to content

Commit 37778ad

Browse files
podedra92Prakash Odedracode-asher
authored
Use @ to delineate versions (#24)
Co-authored-by: Prakash Odedra <[email protected]> Co-authored-by: Asher <[email protected]>
1 parent f2cf923 commit 37778ad

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Extensions can be removed from the marketplace by ID and version or `--all` to
130130
remove all versions.
131131

132132
```console
133-
./code-marketplace remove ms-python.python-2022.14.0 [flags]
133+
./code-marketplace remove ms-python.python@2022.14.0 [flags]
134134
./code-marketplace remove ms-python.python --all [flags]
135135
```
136136

Diff for: cli/remove.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func remove() *cobra.Command {
2929
Use: "remove <id>",
3030
Short: "Remove an extension from the marketplace",
3131
Example: strings.Join([]string{
32-
" marketplace remove publisher.extension-1.0.0 --extensions-dir ./extensions",
32+
" marketplace remove publisher.extension@1.0.0 --extensions-dir ./extensions",
3333
" marketplace remove publisher.extension --all --artifactory http://artifactory.server/artifactory --repo extensions",
3434
}, "\n"),
3535
Args: cobra.ExactArgs(1),
@@ -78,7 +78,7 @@ func remove() *cobra.Command {
7878
return xerrors.Errorf("%s.%s has no versions to delete", publisher, name)
7979
} else if version == "" && !all {
8080
return xerrors.Errorf(
81-
"use %s-<version> to target a specific version or pass --all to delete %s of %s",
81+
"use %s@<version> to target a specific version or pass --all to delete %s of %s",
8282
id,
8383
util.Plural(versionCount, "version", ""),
8484
id,

Diff for: cli/remove_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func TestRemove(t *testing.T) {
108108

109109
id := fmt.Sprintf("%s.%s", test.extension.Publisher, test.extension.Name)
110110
if test.version != "" {
111-
id = fmt.Sprintf("%s-%s", id, test.version)
111+
id = fmt.Sprintf("%s@%s", id, test.version)
112112
}
113113

114114
cmd := cli.Root()

Diff for: fixtures/generate.bash

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ EOF
105105
cat<<EOF > "$dest/extension/extension.js"
106106
const vscode = require("vscode");
107107
function activate(context) {
108-
vscode.window.showInformationMessage("mock extension $publisher.$name-$version loaded");
108+
vscode.window.showInformationMessage("mock extension $publisher.$name@$version loaded");
109109
}
110110
exports.activate = activate;
111111
EOF
@@ -121,8 +121,8 @@ mock changelog
121121
EOF
122122
cp "$dir/icon.png" "$dest/extension/images/icon.png"
123123
pushd "$dest" >/dev/null
124-
rm "$publisher.$name-$version.vsix"
125-
zip -r "$publisher.$name-$version.vsix" * -q
124+
rm "$publisher.$name@$version.vsix"
125+
zip -r "$publisher.$name@$version.vsix" * -q
126126
popd >/dev/null
127127
done < "$dir/versions"
128128
done < "$dir/names"

Diff for: storage/storage.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,16 @@ func ExtensionIDFromManifest(manifest *VSIXManifest) string {
250250

251251
// ExtensionID returns the full ID of an extension.
252252
func ExtensionID(publisher, name, version string) string {
253-
return fmt.Sprintf("%s.%s-%s", publisher, name, version)
253+
return fmt.Sprintf("%s.%s@%s", publisher, name, version)
254254
}
255255

256256
// ParseExtensionID parses an extension ID into its separate parts: publisher,
257257
// name, and version (version may be blank).
258258
func ParseExtensionID(id string) (string, string, string, error) {
259-
re := regexp.MustCompile(`^([^.]+)\.([^-]+)-?(.*)$`)
259+
re := regexp.MustCompile(`^([^.]+)\.([^@]+)@?(.*)$`)
260260
match := re.FindAllStringSubmatch(id, -1)
261261
if match == nil {
262-
return "", "", "", xerrors.Errorf("\"%s\" does not match <publisher>.<name> or <publisher>.<name>-<version>", id)
262+
return "", "", "", xerrors.Errorf("\"%s\" does not match <publisher>.<name> or <publisher>.<name>@<version>", id)
263263
}
264264
return match[0][1], match[0][2], match[0][3], nil
265265
}

Diff for: storage/storage_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func testManifest(t *testing.T, factory storageFactory) {
230230
name: "MissingVersion",
231231
error: fs.ErrNotExist,
232232
extension: testutil.Extensions[0],
233-
version: "some-nonexistent-version",
233+
version: "some-nonexistent@version",
234234
},
235235
{
236236
name: "MissingExtension",
@@ -275,7 +275,7 @@ func testManifest(t *testing.T, factory storageFactory) {
275275
// manifest since it is not on the actual manifest on disk.
276276
expected.Assets.Asset = append(expected.Assets.Asset, storage.VSIXAsset{
277277
Type: storage.VSIXAssetType,
278-
Path: fmt.Sprintf("%s.%s-%s.vsix", test.extension.Publisher, test.extension.Name, version),
278+
Path: fmt.Sprintf("%s.%s@%s.vsix", test.extension.Publisher, test.extension.Name, version),
279279
Addressable: "true",
280280
})
281281
require.NoError(t, err)
@@ -335,7 +335,7 @@ func testWalkExtensions(t *testing.T, factory storageFactory) {
335335
// manifest since it is not on the actual manifest on disk.
336336
manifest.Assets.Asset = append(manifest.Assets.Asset, storage.VSIXAsset{
337337
Type: storage.VSIXAssetType,
338-
Path: fmt.Sprintf("%s.%s-%s.vsix", ext.Publisher, ext.Name, ext.LatestVersion),
338+
Path: fmt.Sprintf("%s.%s@%s.vsix", ext.Publisher, ext.Name, ext.LatestVersion),
339339
Addressable: "true",
340340
})
341341
expected = append(expected, extension{
@@ -734,7 +734,7 @@ func testAddExtension(t *testing.T, factory storageFactory) {
734734
// Put a directory in the way of the vsix.
735735
f := factory(t)
736736
ext := testutil.Extensions[3]
737-
vsixName := fmt.Sprintf("%s.%s-%s.vsix", ext.Publisher, ext.Name, ext.LatestVersion)
737+
vsixName := fmt.Sprintf("%s.%s@%s.vsix", ext.Publisher, ext.Name, ext.LatestVersion)
738738
f.write([]byte("foo"), ext.Publisher, ext.Name, ext.LatestVersion, vsixName, "foo")
739739

740740
for _, test := range tests {
@@ -909,7 +909,7 @@ func TestExtensionID(t *testing.T) {
909909
}{
910910
{
911911
name: "OK",
912-
expected: "foo.bar-test",
912+
expected: "foo.bar@test",
913913
manifest: &storage.VSIXManifest{
914914
Metadata: storage.VSIXMetadata{
915915
Identity: storage.VSIXIdentity{
@@ -948,12 +948,12 @@ func TestParseExtensionID(t *testing.T) {
948948
{
949949
name: "OK",
950950
expected: []string{"foo", "bar", "test"},
951-
id: "foo.bar-test",
951+
id: "foo.bar@test",
952952
},
953953
{
954954
name: "VersionWithDots",
955955
expected: []string{"foo", "bar", "test.test"},
956-
id: "foo.bar-test.test",
956+
id: "foo.bar@test.test",
957957
},
958958
{
959959
name: "EmptyID",
@@ -963,12 +963,12 @@ func TestParseExtensionID(t *testing.T) {
963963
{
964964
name: "MissingPublisher",
965965
error: true,
966-
id: ".qux-bar",
966+
id: ".qux@bar",
967967
},
968968
{
969969
name: "MissingExtension",
970970
error: true,
971-
id: "foo.-baz",
971+
id: "foo.@baz",
972972
},
973973
{
974974
name: "MissingExtensionAndVersion",
@@ -983,7 +983,7 @@ func TestParseExtensionID(t *testing.T) {
983983
{
984984
name: "InvalidID",
985985
error: true,
986-
id: "publisher-version",
986+
id: "publisher@version",
987987
},
988988
}
989989

0 commit comments

Comments
 (0)