vscode-offline 0.1.6__tar.gz → 0.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. vscode_offline-0.1.6/.github/workflows/publish.yml → vscode_offline-0.1.7/.github/workflows/build.yml +33 -2
  2. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/.gitignore +3 -0
  3. vscode_offline-0.1.7/PKG-INFO +137 -0
  4. vscode_offline-0.1.7/README.md +114 -0
  5. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/pyproject.toml +4 -1
  6. vscode_offline-0.1.7/src/vscode_offline/__init__.py +9 -0
  7. vscode_offline-0.1.7/src/vscode_offline/_version.py +34 -0
  8. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/src/vscode_offline/app.py +43 -18
  9. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/src/vscode_offline/download.py +30 -18
  10. vscode_offline-0.1.7/src/vscode_offline/py.typed +0 -0
  11. vscode_offline-0.1.7/src/vscode_offline/utils.py +267 -0
  12. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/tests/test_utils.py +12 -9
  13. vscode_offline-0.1.6/.github/workflows/test.yml +0 -38
  14. vscode_offline-0.1.6/PKG-INFO +0 -83
  15. vscode_offline-0.1.6/README.md +0 -60
  16. vscode_offline-0.1.6/src/vscode_offline/__init__.py +0 -3
  17. vscode_offline-0.1.6/src/vscode_offline/utils.py +0 -131
  18. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/.editorconfig +0 -0
  19. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/.python-version +0 -0
  20. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/.vscode/extensions.json +0 -0
  21. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/.vscode/settings.json +0 -0
  22. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/LICENSE +0 -0
  23. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/lefthook.yml +0 -0
  24. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/pyrightconfig.json +0 -0
  25. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/src/vscode_offline/install.py +0 -0
  26. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/src/vscode_offline/loggers.py +0 -0
  27. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/tests/test_install.py +0 -0
  28. {vscode_offline-0.1.6 → vscode_offline-0.1.7}/uv.lock +0 -0
@@ -1,4 +1,4 @@
1
- name: Publish
1
+ name: Build
2
2
 
3
3
  on:
4
4
  push:
@@ -8,8 +8,39 @@ on:
8
8
  - "v*"
9
9
 
10
10
  jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - name: Checkout project
16
+ uses: actions/checkout@v5
17
+ with:
18
+ fetch-depth: 0 # Shallow clones should be disabled for a proper tag checkout
19
+
20
+ - name: Set up uv
21
+ uses: astral-sh/setup-uv@v6
22
+ with:
23
+ enable-cache: true
24
+
25
+ - name: Install dependencies
26
+ run: uv sync --locked
27
+
28
+ - name: Lint with ruff
29
+ run: uv run ruff check
30
+
31
+ - name: Type check with pyright
32
+ run: uv run pyright
33
+
34
+ - name: Format with ruff
35
+ run: uv run ruff format --check
36
+
37
+ - name: Run tests with pytest
38
+ run: uv run pytest tests
39
+
11
40
  publish:
12
41
  runs-on: ubuntu-latest
42
+ # This job depends on the successful completion of the 'test' job
43
+ needs: test
13
44
 
14
45
  permissions:
15
46
  contents: write # IMPORTANT: this permission is mandatory for uploading release assets
@@ -19,7 +50,7 @@ jobs:
19
50
  - name: Checkout project
20
51
  uses: actions/checkout@v5
21
52
  with:
22
- fetch-depth: 0 # Shallow clones should be disabled for a proper tag checkout
53
+ fetch-depth: 0 # Shallow clones should be disabled for a proper tag checkout
23
54
 
24
55
  - name: Set up uv
25
56
  uses: astral-sh/setup-uv@v6
@@ -10,5 +10,8 @@ wheels/
10
10
  # Virtual environments
11
11
  .venv
12
12
 
13
+ # Hatch VCS version file
14
+ /src/vscode_offline/_version.py
15
+
13
16
  # VS Code offline installer directory
14
17
  vscode-offline-installer/
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: vscode-offline
3
+ Version: 0.1.7
4
+ Summary: Download and install VS Code for offline environments
5
+ Project-URL: Homepage, https://github.com/fanck0605/vscode-offline
6
+ Author-email: Chuck Fan <fanck0605@qq.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Utilities
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+
24
+ # vscode-offline
25
+
26
+ [![Build Status](https://github.com/fanck0605/vscode-offline/workflows/Build/badge.svg)](https://github.com/fanck0605/vscode-offline/actions/workflows/build.yml)
27
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
28
+ [![PyPI Version](https://img.shields.io/pypi/v/vscode-offline)](https://pypi.org/project/vscode-offline/)
29
+ [![License](https://img.shields.io/github/license/fanck0605/vscode-offline)](https://github.com/fanck0605/vscode-offline/blob/master/LICENSE)
30
+
31
+ **vscode-offline** 主要用于在无网环境下安装 VS Code 和 VS Code Server,方便使用 [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) 插件进行远程开发。
32
+
33
+ ## 安装
34
+
35
+ ```shell
36
+ pip install -U vscode-offline
37
+ ```
38
+
39
+ ## 优势
40
+
41
+ 1. 自动识别并下载所有 `.vsix` 文件(包括间接依赖)
42
+ 2. 一键安装 VS Code Server 以及其所有插件
43
+
44
+ ## VS Code 离线安装
45
+
46
+ (1)在联网环境安装好 VS Code 和你需要的插件,如 [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh), [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) 等。
47
+
48
+ (2)执行如下命令,下载 VS Code 安装包,和目前安装的所有的插件
49
+
50
+ ```shell
51
+ vscode-offline download-all --client-platform win32-x64 --server-platform linux-x64
52
+ ```
53
+
54
+ (3)复制 `./vscode-offline-installer` 到内网 Windows 机器,安装 `client-<version>` 下的 VS Code,然后执行如下命令安装所有插件
55
+
56
+ ```shell
57
+ vscode-offline install-extensions --installer ./vscode-offline-installer
58
+ ```
59
+
60
+ (4)复制 `./vscode-offline-installer` 到内网 Linux 服务器,执行如下命令安装 VS Code Server 和所有插件
61
+
62
+ ```shell
63
+ vscode-offline install-server --installer ./vscode-offline-installer
64
+ ```
65
+
66
+ ## 指定 VS Code 版本号
67
+
68
+ 如果你想下载或安装指定版本的 VS Code,可以先通过 `code --version` 获取当前版本,然后通过 --code-version 参数指定版本号,例如:
69
+
70
+ ```shell
71
+ vscode-offline download-all --code-version 1.104.3
72
+ ```
73
+
74
+ 也支持使用 commit hash 作为版本号,例如:
75
+
76
+ ```shell
77
+ vscode-offline download-all --code-version commit:385651c938df8a906869babee516bffd0ddb9829
78
+ ```
79
+
80
+
81
+ ## 文件下载地址
82
+
83
+ 如果你不想使用 `vscode-offline`,也可以手动下载对应的文件。
84
+
85
+ VS Code / VS Code Server / VS Code CLI 下载地址格式:
86
+
87
+ ```shell
88
+ curl -O https://update.code.visualstudio.com/<version>/<platform>/stable
89
+ curl -O https://update.code.visualstudio.com/commit:<commit>/<platform>/stable
90
+
91
+ # 比如
92
+ curl -O https://update.code.visualstudio.com/1.104.3/cli-alpine-x64/stable
93
+ curl -O https://update.code.visualstudio.com/commit:385651c938df8a906869babee516bffd0ddb9829/win32-x64/stable
94
+ ```
95
+
96
+
97
+ VS Code Extension 下载地址格式:
98
+
99
+ ```shell
100
+ curl -O https://marketplace.visualstudio.com/_apis/public/gallery/publishers/<publisher>/vsextensions/<extension>/<version>/vspackage?targetPlatform=<platform>
101
+
102
+ # 比如
103
+ curl -O https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/2025.14.0/vspackage?targetPlatform=linux-x64
104
+ ```
105
+
106
+ Platform 映射关系:
107
+
108
+ | VS Code | VS Code Server | VS Code CLI | VS Code Extension |
109
+ | ------------------- | ------------------- | ---------------- | ----------------- |
110
+ | win32-x64 | server-win32-x64 | cli-win32-x64 | win32-x64 |
111
+ | win32-x64-user | server-win32-x64 | cli-win32-x64 | win32-x64 |
112
+ | win32-x64-archive | server-win32-x64 | cli-win32-x64 | win32-x64 |
113
+ | win32-arm64 | server-win32-arm64 | cli-win32-arm64 | win32-arm64 |
114
+ | win32-arm64-user | server-win32-arm64 | cli-win32-arm64 | win32-arm64 |
115
+ | win32-arm64-archive | server-win32-arm64 | cli-win32-arm64 | win32-arm64 |
116
+ | linux-x64 | server-linux-x64 | cli-alpine-x64 | linux-x64 |
117
+ | linux-deb-x64 | server-linux-x64 | cli-alpine-x64 | linux-x64 |
118
+ | linux-rpm-x64 | server-linux-x64 | cli-alpine-x64 | linux-x64 |
119
+ | linux-arm64 | server-linux-arm64 | cli-alpine-arm64 | linux-arm64 |
120
+ | linux-deb-arm64 | server-linux-arm64 | cli-alpine-arm64 | linux-arm64 |
121
+ | linux-rpm-arm64 | server-linux-arm64 | cli-alpine-arm64 | linux-arm64 |
122
+ | linux-armhf | server-linux-armhf | cli-linux-armhf | linux-armhf |
123
+ | linux-deb-armhf | server-linux-armhf | cli-linux-armhf | linux-armhf |
124
+ | linux-rpm-armhf | server-linux-armhf | cli-linux-armhf | linux-armhf |
125
+ | darwin | server-darwin | cli-darwin-x64 | darwin-x64 |
126
+ | darwin-arm64 | server-darwin-arm64 | cli-darwin-arm64 | darwin-arm64 |
127
+
128
+
129
+ ## 贡献
130
+
131
+ 欢迎提交 Issue 和 PR 改进本项目。
132
+
133
+ ## License
134
+
135
+ Copyright (c) 2025 Chuck Fan.
136
+
137
+ Distributed under the terms of the [MIT License](https://github.com/fanck0605/vscode-offline/blob/master/LICENSE).
@@ -0,0 +1,114 @@
1
+ # vscode-offline
2
+
3
+ [![Build Status](https://github.com/fanck0605/vscode-offline/workflows/Build/badge.svg)](https://github.com/fanck0605/vscode-offline/actions/workflows/build.yml)
4
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
5
+ [![PyPI Version](https://img.shields.io/pypi/v/vscode-offline)](https://pypi.org/project/vscode-offline/)
6
+ [![License](https://img.shields.io/github/license/fanck0605/vscode-offline)](https://github.com/fanck0605/vscode-offline/blob/master/LICENSE)
7
+
8
+ **vscode-offline** 主要用于在无网环境下安装 VS Code 和 VS Code Server,方便使用 [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) 插件进行远程开发。
9
+
10
+ ## 安装
11
+
12
+ ```shell
13
+ pip install -U vscode-offline
14
+ ```
15
+
16
+ ## 优势
17
+
18
+ 1. 自动识别并下载所有 `.vsix` 文件(包括间接依赖)
19
+ 2. 一键安装 VS Code Server 以及其所有插件
20
+
21
+ ## VS Code 离线安装
22
+
23
+ (1)在联网环境安装好 VS Code 和你需要的插件,如 [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh), [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) 等。
24
+
25
+ (2)执行如下命令,下载 VS Code 安装包,和目前安装的所有的插件
26
+
27
+ ```shell
28
+ vscode-offline download-all --client-platform win32-x64 --server-platform linux-x64
29
+ ```
30
+
31
+ (3)复制 `./vscode-offline-installer` 到内网 Windows 机器,安装 `client-<version>` 下的 VS Code,然后执行如下命令安装所有插件
32
+
33
+ ```shell
34
+ vscode-offline install-extensions --installer ./vscode-offline-installer
35
+ ```
36
+
37
+ (4)复制 `./vscode-offline-installer` 到内网 Linux 服务器,执行如下命令安装 VS Code Server 和所有插件
38
+
39
+ ```shell
40
+ vscode-offline install-server --installer ./vscode-offline-installer
41
+ ```
42
+
43
+ ## 指定 VS Code 版本号
44
+
45
+ 如果你想下载或安装指定版本的 VS Code,可以先通过 `code --version` 获取当前版本,然后通过 --code-version 参数指定版本号,例如:
46
+
47
+ ```shell
48
+ vscode-offline download-all --code-version 1.104.3
49
+ ```
50
+
51
+ 也支持使用 commit hash 作为版本号,例如:
52
+
53
+ ```shell
54
+ vscode-offline download-all --code-version commit:385651c938df8a906869babee516bffd0ddb9829
55
+ ```
56
+
57
+
58
+ ## 文件下载地址
59
+
60
+ 如果你不想使用 `vscode-offline`,也可以手动下载对应的文件。
61
+
62
+ VS Code / VS Code Server / VS Code CLI 下载地址格式:
63
+
64
+ ```shell
65
+ curl -O https://update.code.visualstudio.com/<version>/<platform>/stable
66
+ curl -O https://update.code.visualstudio.com/commit:<commit>/<platform>/stable
67
+
68
+ # 比如
69
+ curl -O https://update.code.visualstudio.com/1.104.3/cli-alpine-x64/stable
70
+ curl -O https://update.code.visualstudio.com/commit:385651c938df8a906869babee516bffd0ddb9829/win32-x64/stable
71
+ ```
72
+
73
+
74
+ VS Code Extension 下载地址格式:
75
+
76
+ ```shell
77
+ curl -O https://marketplace.visualstudio.com/_apis/public/gallery/publishers/<publisher>/vsextensions/<extension>/<version>/vspackage?targetPlatform=<platform>
78
+
79
+ # 比如
80
+ curl -O https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/2025.14.0/vspackage?targetPlatform=linux-x64
81
+ ```
82
+
83
+ Platform 映射关系:
84
+
85
+ | VS Code | VS Code Server | VS Code CLI | VS Code Extension |
86
+ | ------------------- | ------------------- | ---------------- | ----------------- |
87
+ | win32-x64 | server-win32-x64 | cli-win32-x64 | win32-x64 |
88
+ | win32-x64-user | server-win32-x64 | cli-win32-x64 | win32-x64 |
89
+ | win32-x64-archive | server-win32-x64 | cli-win32-x64 | win32-x64 |
90
+ | win32-arm64 | server-win32-arm64 | cli-win32-arm64 | win32-arm64 |
91
+ | win32-arm64-user | server-win32-arm64 | cli-win32-arm64 | win32-arm64 |
92
+ | win32-arm64-archive | server-win32-arm64 | cli-win32-arm64 | win32-arm64 |
93
+ | linux-x64 | server-linux-x64 | cli-alpine-x64 | linux-x64 |
94
+ | linux-deb-x64 | server-linux-x64 | cli-alpine-x64 | linux-x64 |
95
+ | linux-rpm-x64 | server-linux-x64 | cli-alpine-x64 | linux-x64 |
96
+ | linux-arm64 | server-linux-arm64 | cli-alpine-arm64 | linux-arm64 |
97
+ | linux-deb-arm64 | server-linux-arm64 | cli-alpine-arm64 | linux-arm64 |
98
+ | linux-rpm-arm64 | server-linux-arm64 | cli-alpine-arm64 | linux-arm64 |
99
+ | linux-armhf | server-linux-armhf | cli-linux-armhf | linux-armhf |
100
+ | linux-deb-armhf | server-linux-armhf | cli-linux-armhf | linux-armhf |
101
+ | linux-rpm-armhf | server-linux-armhf | cli-linux-armhf | linux-armhf |
102
+ | darwin | server-darwin | cli-darwin-x64 | darwin-x64 |
103
+ | darwin-arm64 | server-darwin-arm64 | cli-darwin-arm64 | darwin-arm64 |
104
+
105
+
106
+ ## 贡献
107
+
108
+ 欢迎提交 Issue 和 PR 改进本项目。
109
+
110
+ ## License
111
+
112
+ Copyright (c) 2025 Chuck Fan.
113
+
114
+ Distributed under the terms of the [MIT License](https://github.com/fanck0605/vscode-offline/blob/master/LICENSE).
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  name = "vscode-offline"
7
7
  dynamic = ["version"]
8
- description = "Download and install VS Code Server for offline environments"
8
+ description = "Download and install VS Code for offline environments"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Chuck Fan", email = "fanck0605@qq.com" }]
11
11
  requires-python = ">=3.9"
@@ -45,6 +45,9 @@ dev = [
45
45
  [tool.hatch.version]
46
46
  source = "vcs"
47
47
 
48
+ [tool.hatch.build.hooks.vcs]
49
+ version-file = "src/vscode_offline/_version.py"
50
+
48
51
  [tool.ruff.lint]
49
52
  select = [
50
53
  "ANN", # flake8-annotations
@@ -0,0 +1,9 @@
1
+ from vscode_offline._version import __commit_id__, __version__, __version_tuple__
2
+ from vscode_offline.app import main
3
+
4
+ __all__ = (
5
+ "__commit_id__",
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "main",
9
+ )
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.1.7'
32
+ __version_tuple__ = version_tuple = (0, 1, 7)
33
+
34
+ __commit_id__ = commit_id = None
@@ -4,6 +4,7 @@ import logging
4
4
  from argparse import ArgumentParser, Namespace
5
5
  from pathlib import Path
6
6
 
7
+ from vscode_offline._version import __version__
7
8
  from vscode_offline.download import (
8
9
  download_vscode_client,
9
10
  download_vscode_extensions,
@@ -15,10 +16,14 @@ from vscode_offline.install import (
15
16
  install_vscode_server,
16
17
  )
17
18
  from vscode_offline.utils import (
19
+ get_client_platform,
18
20
  get_default_code_version,
21
+ get_extension_platform,
19
22
  get_host_platform,
23
+ get_server_platform,
20
24
  get_vscode_extensions_config,
21
25
  get_vscode_version_from_server_installer,
26
+ validate_platform,
22
27
  )
23
28
 
24
29
 
@@ -33,12 +38,14 @@ def cmd_download_server(args: Namespace) -> None:
33
38
  download_vscode_server(
34
39
  args.code_version,
35
40
  output=args.installer / f"server-{args.code_version.replace(':', '-')}",
36
- platform=args.platform,
41
+ platform=get_server_platform(args.platform),
37
42
  )
38
43
  extensions_config = Path(args.extensions_config).expanduser()
39
44
  download_vscode_extensions(
40
45
  extensions_config,
41
- target_platforms=[args.platform],
46
+ target_platforms={
47
+ get_extension_platform(args.platform),
48
+ },
42
49
  output=args.installer / "extensions",
43
50
  )
44
51
 
@@ -57,12 +64,12 @@ def cmd_install_server(args: Namespace) -> None:
57
64
 
58
65
  vscode_server_home = install_vscode_server(
59
66
  server_installer=args.installer / f"server-{args.code_version}",
60
- platform=host_platform,
67
+ platform=get_server_platform(host_platform),
61
68
  )
62
69
  install_vscode_extensions(
63
70
  Path(vscode_server_home) / "bin/code-server",
64
71
  vsix_dir=args.installer / "extensions",
65
- platform=host_platform,
72
+ platform=get_extension_platform(host_platform),
66
73
  exclude=SERVER_EXCLUDE_EXTENSIONS,
67
74
  )
68
75
 
@@ -71,7 +78,9 @@ def cmd_download_extensions(args: Namespace) -> None:
71
78
  extensions_config = Path(args.extensions_config).expanduser()
72
79
  download_vscode_extensions(
73
80
  extensions_config,
74
- target_platforms=[args.platform],
81
+ target_platforms={
82
+ get_extension_platform(args.platform),
83
+ },
75
84
  output=args.installer / "extensions",
76
85
  )
77
86
 
@@ -81,7 +90,7 @@ def cmd_install_extensions(args: Namespace) -> None:
81
90
  install_vscode_extensions(
82
91
  args.code,
83
92
  vsix_dir=args.installer / "extensions",
84
- platform=host_platform,
93
+ platform=get_extension_platform(host_platform),
85
94
  )
86
95
 
87
96
 
@@ -96,12 +105,14 @@ def cmd_download_client(args: Namespace) -> None:
96
105
  download_vscode_client(
97
106
  args.code_version,
98
107
  output=args.installer / f"client-{args.code_version.replace(':', '-')}",
99
- platform=args.platform,
108
+ platform=get_client_platform(args.platform),
100
109
  )
101
110
  extensions_config = Path(args.extensions_config).expanduser()
102
111
  download_vscode_extensions(
103
112
  extensions_config,
104
- target_platforms=[args.platform],
113
+ target_platforms={
114
+ get_extension_platform(args.platform),
115
+ },
105
116
  output=args.installer / "extensions",
106
117
  )
107
118
 
@@ -117,21 +128,29 @@ def cmd_download_all(args: Namespace) -> None:
117
128
  download_vscode_server(
118
129
  args.code_version,
119
130
  output=args.installer / f"server-{args.code_version.replace(':', '-')}",
120
- platform=args.server_platform,
131
+ platform=get_server_platform(args.server_platform),
121
132
  )
122
133
  download_vscode_client(
123
134
  args.code_version,
124
135
  output=args.installer / f"client-{args.code_version.replace(':', '-')}",
125
- platform=args.client_platform,
136
+ platform=get_client_platform(args.client_platform),
126
137
  )
127
138
  extensions_config = Path(args.extensions_config).expanduser()
128
139
  download_vscode_extensions(
129
140
  extensions_config,
130
- target_platforms=[args.server_platform, args.client_platform],
141
+ target_platforms={
142
+ get_extension_platform(args.server_platform),
143
+ get_extension_platform(args.client_platform),
144
+ },
131
145
  output=args.installer / "extensions",
132
146
  )
133
147
 
134
148
 
149
+ def cmd_version(args: Namespace) -> None:
150
+ # print version instead of logging
151
+ print(__version__)
152
+
153
+
135
154
  def make_argparser() -> ArgumentParser:
136
155
  parent_parser = ArgumentParser(add_help=False)
137
156
 
@@ -145,6 +164,12 @@ def make_argparser() -> ArgumentParser:
145
164
  parser = ArgumentParser()
146
165
  subparsers = parser.add_subparsers(required=True)
147
166
 
167
+ version_parser = subparsers.add_parser(
168
+ "version",
169
+ help="Show version information",
170
+ )
171
+ version_parser.set_defaults(func=cmd_version)
172
+
148
173
  download_server_parser = subparsers.add_parser(
149
174
  "download-server",
150
175
  help="Download VS Code Server and extensions",
@@ -158,7 +183,7 @@ def make_argparser() -> ArgumentParser:
158
183
  )
159
184
  download_server_parser.add_argument(
160
185
  "--platform",
161
- type=str,
186
+ type=validate_platform,
162
187
  required=True,
163
188
  help="The target platform of the VS Code Server to download.",
164
189
  )
@@ -189,7 +214,7 @@ def make_argparser() -> ArgumentParser:
189
214
  download_extensions_parser.set_defaults(func=cmd_download_extensions)
190
215
  download_extensions_parser.add_argument(
191
216
  "--platform",
192
- type=str,
217
+ type=validate_platform,
193
218
  required=True,
194
219
  help="The target platform of the VS Code extensions to download.",
195
220
  )
@@ -226,7 +251,7 @@ def make_argparser() -> ArgumentParser:
226
251
  )
227
252
  download_client_parser.add_argument(
228
253
  "--platform",
229
- type=str,
254
+ type=validate_platform,
230
255
  required=True,
231
256
  help="The target platform of the VS Code to download.",
232
257
  )
@@ -250,14 +275,14 @@ def make_argparser() -> ArgumentParser:
250
275
  )
251
276
  download_all_parser.add_argument(
252
277
  "--server-platform",
253
- type=str,
254
- default="linux-x64",
278
+ type=validate_platform,
279
+ required=True,
255
280
  help="The target platform of the VS Code Server to download, defaults to linux-x64.",
256
281
  )
257
282
  download_all_parser.add_argument(
258
283
  "--client-platform",
259
- type=str,
260
- default="win32-x64",
284
+ type=validate_platform,
285
+ required=True,
261
286
  help="The target platform of the VS Code to download, defaults to win32-x64.",
262
287
  )
263
288
  download_all_parser.add_argument(