vscode-offline 0.1.3__tar.gz → 0.1.5__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.
- vscode_offline-0.1.5/.editorconfig +16 -0
- vscode_offline-0.1.5/.github/workflows/publish.yml +50 -0
- vscode_offline-0.1.5/.github/workflows/test.yml +38 -0
- vscode_offline-0.1.5/.gitignore +14 -0
- vscode_offline-0.1.5/.python-version +1 -0
- vscode_offline-0.1.5/.vscode/extensions.json +9 -0
- vscode_offline-0.1.5/.vscode/settings.json +15 -0
- {vscode_offline-0.1.3 → vscode_offline-0.1.5}/PKG-INFO +21 -20
- vscode_offline-0.1.5/README.md +60 -0
- vscode_offline-0.1.5/lefthook.yml +15 -0
- {vscode_offline-0.1.3 → vscode_offline-0.1.5}/pyproject.toml +14 -10
- vscode_offline-0.1.5/pyrightconfig.json +3 -0
- vscode_offline-0.1.5/src/vscode_offline/app.py +281 -0
- vscode_offline-0.1.5/src/vscode_offline/download.py +167 -0
- {vscode_offline-0.1.3 → vscode_offline-0.1.5}/src/vscode_offline/install.py +37 -17
- {vscode_offline-0.1.3 → vscode_offline-0.1.5}/src/vscode_offline/utils.py +39 -21
- vscode_offline-0.1.5/tests/test_install.py +27 -0
- vscode_offline-0.1.5/tests/test_utils.py +45 -0
- vscode_offline-0.1.5/uv.lock +337 -0
- vscode_offline-0.1.3/README.md +0 -58
- vscode_offline-0.1.3/src/vscode_offline/app.py +0 -183
- vscode_offline-0.1.3/src/vscode_offline/download.py +0 -119
- {vscode_offline-0.1.3 → vscode_offline-0.1.5}/LICENSE +0 -0
- {vscode_offline-0.1.3 → vscode_offline-0.1.5}/src/vscode_offline/__init__.py +0 -0
- {vscode_offline-0.1.3 → vscode_offline-0.1.5}/src/vscode_offline/loggers.py +0 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
root = true
|
2
|
+
|
3
|
+
[*]
|
4
|
+
indent_style = space
|
5
|
+
charset = utf-8
|
6
|
+
end_of_line = lf
|
7
|
+
trim_trailing_whitespace = true
|
8
|
+
insert_final_newline = true
|
9
|
+
|
10
|
+
# Disable rules for VS Code settings files
|
11
|
+
[.vscode/**]
|
12
|
+
indent_style = unset
|
13
|
+
charset = unset
|
14
|
+
end_of_line = unset
|
15
|
+
trim_trailing_whitespace = unset
|
16
|
+
insert_final_newline = unset
|
@@ -0,0 +1,50 @@
|
|
1
|
+
name: Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- "**"
|
7
|
+
tags:
|
8
|
+
- "v*"
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
publish:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
permissions:
|
15
|
+
contents: write # IMPORTANT: this permission is mandatory for uploading release assets
|
16
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- name: Checkout project
|
20
|
+
uses: actions/checkout@v5
|
21
|
+
with:
|
22
|
+
fetch-depth: 0 # Shallow clones should be disabled for a proper tag checkout
|
23
|
+
|
24
|
+
- name: Set up uv
|
25
|
+
uses: astral-sh/setup-uv@v6
|
26
|
+
with:
|
27
|
+
enable-cache: true
|
28
|
+
|
29
|
+
- name: Build distribution
|
30
|
+
run: uv build
|
31
|
+
|
32
|
+
- name: Upload artifacts
|
33
|
+
uses: actions/upload-artifact@v4
|
34
|
+
with:
|
35
|
+
name: vscode-offline
|
36
|
+
path: |
|
37
|
+
dist/vscode_offline-*.tar.gz
|
38
|
+
dist/vscode_offline-*.whl
|
39
|
+
|
40
|
+
- name: Upload release assets
|
41
|
+
uses: softprops/action-gh-release@v2
|
42
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
43
|
+
with:
|
44
|
+
files: |
|
45
|
+
dist/vscode_offline-*.tar.gz
|
46
|
+
dist/vscode_offline-*.whl
|
47
|
+
|
48
|
+
- name: Publish release to PyPI
|
49
|
+
uses: pypa/gh-action-pypi-publish@v1.13.0
|
50
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- "**"
|
7
|
+
tags:
|
8
|
+
- "v*"
|
9
|
+
|
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
|
@@ -0,0 +1 @@
|
|
1
|
+
3.9
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"[python]": {
|
3
|
+
"editor.formatOnSave": true,
|
4
|
+
"editor.defaultFormatter": "charliermarsh.ruff",
|
5
|
+
"editor.codeActionsOnSave": {
|
6
|
+
"source.fixAll": "explicit",
|
7
|
+
"source.organizeImports": "explicit"
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"python.testing.pytestArgs": [
|
11
|
+
"tests"
|
12
|
+
],
|
13
|
+
"python.testing.unittestEnabled": false,
|
14
|
+
"python.testing.pytestEnabled": true
|
15
|
+
}
|
@@ -1,25 +1,24 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: vscode-offline
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.5
|
4
4
|
Summary: Download and install VS Code Server for offline environments
|
5
|
-
|
5
|
+
Project-URL: Homepage, https://github.com/fanck0605/vscode-offline
|
6
6
|
Author-email: Chuck Fan <fanck0605@qq.com>
|
7
7
|
License-Expression: MIT
|
8
8
|
License-File: LICENSE
|
9
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
|
10
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
11
15
|
Classifier: Programming Language :: Python :: 3.9
|
12
16
|
Classifier: Programming Language :: Python :: 3.10
|
13
17
|
Classifier: Programming Language :: Python :: 3.11
|
14
18
|
Classifier: Programming Language :: Python :: 3.12
|
15
19
|
Classifier: Programming Language :: Python :: 3.13
|
16
|
-
Classifier: Intended Audience :: Developers
|
17
|
-
Classifier: License :: OSI Approved :: MIT License
|
18
|
-
Classifier: Operating System :: POSIX :: Linux
|
19
|
-
Classifier: Operating System :: Microsoft :: Windows
|
20
20
|
Classifier: Topic :: Utilities
|
21
21
|
Requires-Python: >=3.9
|
22
|
-
Project-URL: Homepage, https://github.com/fanck0605/vscode-offline
|
23
22
|
Description-Content-Type: text/markdown
|
24
23
|
|
25
24
|
# vscode-offline
|
@@ -37,38 +36,40 @@ pip install -U vscode-offline
|
|
37
36
|
1. 自动识别并下载所有 `.vsix` 文件(包括间接依赖)
|
38
37
|
2. 一键安装 VS Code Server 以及所有插件
|
39
38
|
|
40
|
-
## VS Code
|
39
|
+
## VS Code 离线安装
|
41
40
|
|
42
|
-
(1)在联网环境安装好
|
41
|
+
(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) 等。
|
43
42
|
|
44
|
-
(2
|
43
|
+
(2)执行如下命令,下载 VS Code 安装包,和目前安装的所有的插件
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
```shell
|
46
|
+
vscode-offline download-all --installer ./vscode-offline-installer
|
47
|
+
```
|
48
|
+
|
49
|
+
(3)复制 `./vscode-offline-installer` 到内网 Windows 机器,安装 `client-<version>` 下的 VS Code,然后执行如下命令安装所有插件
|
49
50
|
|
50
51
|
```shell
|
51
|
-
vscode-offline
|
52
|
+
vscode-offline install-extensions --installer ./vscode-offline-installer
|
52
53
|
```
|
53
54
|
|
54
|
-
(
|
55
|
+
(4)复制 `./vscode-offline-installer` 到内网 Linux 服务器,执行如下命令安装 VS Code Server 和所有插件
|
55
56
|
|
56
57
|
```shell
|
57
58
|
vscode-offline install-server --installer ./vscode-offline-installer
|
58
59
|
```
|
59
60
|
|
60
|
-
## VS Code
|
61
|
+
## 指定 VS Code 版本号
|
61
62
|
|
62
|
-
|
63
|
+
如果你想下载或安装指定版本的 VS Code,可以先通过 `code --version` 获取当前版本,然后通过 --code-version 参数指定版本号,例如:
|
63
64
|
|
64
65
|
```shell
|
65
|
-
vscode-offline download-
|
66
|
+
vscode-offline download-all --code-version 1.104.3
|
66
67
|
```
|
67
68
|
|
68
|
-
|
69
|
+
也支持使用 commit hash 作为版本号,例如:
|
69
70
|
|
70
71
|
```shell
|
71
|
-
vscode-offline
|
72
|
+
vscode-offline download-all --code-version commit:385651c938df8a906869babee516bffd0ddb9829
|
72
73
|
```
|
73
74
|
|
74
75
|
## 贡献
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# vscode-offline
|
2
|
+
|
3
|
+
vscode-offline 主要用于在无网环境下安装 VS Code Server,方便使用 *Remote - SSH* 插件进行远程开发。
|
4
|
+
|
5
|
+
## 安装
|
6
|
+
|
7
|
+
```shell
|
8
|
+
pip install -U vscode-offline
|
9
|
+
```
|
10
|
+
|
11
|
+
## 优势
|
12
|
+
|
13
|
+
1. 自动识别并下载所有 `.vsix` 文件(包括间接依赖)
|
14
|
+
2. 一键安装 VS Code Server 以及所有插件
|
15
|
+
|
16
|
+
## VS Code 离线安装
|
17
|
+
|
18
|
+
(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) 等。
|
19
|
+
|
20
|
+
(2)执行如下命令,下载 VS Code 安装包,和目前安装的所有的插件
|
21
|
+
|
22
|
+
```shell
|
23
|
+
vscode-offline download-all --installer ./vscode-offline-installer
|
24
|
+
```
|
25
|
+
|
26
|
+
(3)复制 `./vscode-offline-installer` 到内网 Windows 机器,安装 `client-<version>` 下的 VS Code,然后执行如下命令安装所有插件
|
27
|
+
|
28
|
+
```shell
|
29
|
+
vscode-offline install-extensions --installer ./vscode-offline-installer
|
30
|
+
```
|
31
|
+
|
32
|
+
(4)复制 `./vscode-offline-installer` 到内网 Linux 服务器,执行如下命令安装 VS Code Server 和所有插件
|
33
|
+
|
34
|
+
```shell
|
35
|
+
vscode-offline install-server --installer ./vscode-offline-installer
|
36
|
+
```
|
37
|
+
|
38
|
+
## 指定 VS Code 版本号
|
39
|
+
|
40
|
+
如果你想下载或安装指定版本的 VS Code,可以先通过 `code --version` 获取当前版本,然后通过 --code-version 参数指定版本号,例如:
|
41
|
+
|
42
|
+
```shell
|
43
|
+
vscode-offline download-all --code-version 1.104.3
|
44
|
+
```
|
45
|
+
|
46
|
+
也支持使用 commit hash 作为版本号,例如:
|
47
|
+
|
48
|
+
```shell
|
49
|
+
vscode-offline download-all --code-version commit:385651c938df8a906869babee516bffd0ddb9829
|
50
|
+
```
|
51
|
+
|
52
|
+
## 贡献
|
53
|
+
|
54
|
+
欢迎提交 Issue 和 PR 改进本项目。
|
55
|
+
|
56
|
+
## License
|
57
|
+
|
58
|
+
Copyright (c) 2025 Chuck Fan.
|
59
|
+
|
60
|
+
Distributed under the terms of the [MIT License](https://github.com/fanck0605/vscode-offline/blob/master/LICENSE).
|
@@ -0,0 +1,15 @@
|
|
1
|
+
lefthook: uv run lefthook
|
2
|
+
|
3
|
+
pre-commit:
|
4
|
+
jobs:
|
5
|
+
- run: ruff check --fix {staged_files}
|
6
|
+
glob: "*.py"
|
7
|
+
stage_fixed: true
|
8
|
+
|
9
|
+
- run: pyright {staged_files}
|
10
|
+
glob: "*.py"
|
11
|
+
stage_fixed: true
|
12
|
+
|
13
|
+
- run: ruff format {staged_files}
|
14
|
+
glob: "*.py"
|
15
|
+
stage_fixed: true
|
@@ -1,11 +1,13 @@
|
|
1
|
+
[build-system]
|
2
|
+
requires = ["hatchling", "hatch-vcs"]
|
3
|
+
build-backend = "hatchling.build"
|
4
|
+
|
1
5
|
[project]
|
2
6
|
name = "vscode-offline"
|
3
|
-
|
7
|
+
dynamic = ["version"]
|
4
8
|
description = "Download and install VS Code Server for offline environments"
|
5
9
|
readme = "README.md"
|
6
|
-
authors = [
|
7
|
-
{ name = "Chuck Fan", email = "fanck0605@qq.com" }
|
8
|
-
]
|
10
|
+
authors = [{ name = "Chuck Fan", email = "fanck0605@qq.com" }]
|
9
11
|
requires-python = ">=3.9"
|
10
12
|
license = "MIT"
|
11
13
|
license-files = ["LICENSE"]
|
@@ -31,19 +33,21 @@ Homepage = "https://github.com/fanck0605/vscode-offline"
|
|
31
33
|
[project.scripts]
|
32
34
|
vscode-offline = "vscode_offline:main"
|
33
35
|
|
34
|
-
[build-system]
|
35
|
-
requires = ["uv-build"]
|
36
|
-
build-backend = "uv_build"
|
37
|
-
|
38
36
|
[dependency-groups]
|
39
37
|
dev = [
|
40
38
|
"lefthook>=1.13.6",
|
41
39
|
"pyright>=1.1.406",
|
40
|
+
"pytest>=8.4.2",
|
41
|
+
"pytest-cov>=7.0.0",
|
42
42
|
"ruff>=0.13.3",
|
43
43
|
]
|
44
44
|
|
45
|
+
[tool.hatch.version]
|
46
|
+
source = "vcs"
|
47
|
+
|
45
48
|
[tool.ruff.lint]
|
46
49
|
select = [
|
47
|
-
"
|
48
|
-
"
|
50
|
+
"ANN", # flake8-annotations
|
51
|
+
"I", # isort
|
52
|
+
"F", # Pyflakes
|
49
53
|
]
|
@@ -0,0 +1,281 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import logging
|
4
|
+
from argparse import ArgumentParser, Namespace
|
5
|
+
from pathlib import Path
|
6
|
+
|
7
|
+
from vscode_offline.download import (
|
8
|
+
download_vscode_client,
|
9
|
+
download_vscode_extensions,
|
10
|
+
download_vscode_server,
|
11
|
+
)
|
12
|
+
from vscode_offline.install import (
|
13
|
+
SERVER_EXCLUDE_EXTENSIONS,
|
14
|
+
install_vscode_extensions,
|
15
|
+
install_vscode_server,
|
16
|
+
)
|
17
|
+
from vscode_offline.utils import (
|
18
|
+
get_default_code_version,
|
19
|
+
get_host_platform,
|
20
|
+
get_vscode_extensions_config,
|
21
|
+
get_vscode_version_from_server_installer,
|
22
|
+
)
|
23
|
+
|
24
|
+
|
25
|
+
def cmd_download_server(args: Namespace) -> None:
|
26
|
+
if args.code_version is None:
|
27
|
+
args.code_version = get_default_code_version()
|
28
|
+
if args.code_version is None:
|
29
|
+
raise ValueError(
|
30
|
+
"Cannot determine version from `code --version`, please specify `--version` when downloading."
|
31
|
+
)
|
32
|
+
|
33
|
+
download_vscode_server(
|
34
|
+
args.code_version,
|
35
|
+
output=args.installer / f"server-{args.code_version.replace(':', '-')}",
|
36
|
+
platform=args.platform,
|
37
|
+
)
|
38
|
+
extensions_config = Path(args.extensions_config).expanduser()
|
39
|
+
download_vscode_extensions(
|
40
|
+
extensions_config,
|
41
|
+
target_platforms=[args.platform],
|
42
|
+
output=args.installer / "extensions",
|
43
|
+
)
|
44
|
+
|
45
|
+
|
46
|
+
def cmd_install_server(args: Namespace) -> None:
|
47
|
+
host_platform = get_host_platform()
|
48
|
+
if args.code_version is None:
|
49
|
+
try:
|
50
|
+
args.code_version = get_vscode_version_from_server_installer(
|
51
|
+
args.installer, host_platform
|
52
|
+
)
|
53
|
+
except Exception as e:
|
54
|
+
raise ValueError(
|
55
|
+
f"{e}, please specify `--version` when installing."
|
56
|
+
) from None
|
57
|
+
|
58
|
+
vscode_server_home = install_vscode_server(
|
59
|
+
server_installer=args.installer / f"server-{args.code_version}",
|
60
|
+
platform=host_platform,
|
61
|
+
)
|
62
|
+
install_vscode_extensions(
|
63
|
+
Path(vscode_server_home) / "bin/code-server",
|
64
|
+
vsix_dir=args.installer / "extensions",
|
65
|
+
platform=host_platform,
|
66
|
+
exclude=SERVER_EXCLUDE_EXTENSIONS,
|
67
|
+
)
|
68
|
+
|
69
|
+
|
70
|
+
def cmd_download_extensions(args: Namespace) -> None:
|
71
|
+
extensions_config = Path(args.extensions_config).expanduser()
|
72
|
+
download_vscode_extensions(
|
73
|
+
extensions_config,
|
74
|
+
target_platforms=[args.platform],
|
75
|
+
output=args.installer / "extensions",
|
76
|
+
)
|
77
|
+
|
78
|
+
|
79
|
+
def cmd_install_extensions(args: Namespace) -> None:
|
80
|
+
host_platform = get_host_platform()
|
81
|
+
install_vscode_extensions(
|
82
|
+
args.code,
|
83
|
+
vsix_dir=args.installer / "extensions",
|
84
|
+
platform=host_platform,
|
85
|
+
)
|
86
|
+
|
87
|
+
|
88
|
+
def cmd_download_client(args: Namespace) -> None:
|
89
|
+
if args.code_version is None:
|
90
|
+
args.code_version = get_default_code_version()
|
91
|
+
if args.code_version is None:
|
92
|
+
raise ValueError(
|
93
|
+
"Cannot determine version from `code --version`, please specify `--version` manually."
|
94
|
+
)
|
95
|
+
|
96
|
+
download_vscode_client(
|
97
|
+
args.code_version,
|
98
|
+
output=args.installer / f"client-{args.code_version.replace(':', '-')}",
|
99
|
+
platform=args.platform,
|
100
|
+
)
|
101
|
+
extensions_config = Path(args.extensions_config).expanduser()
|
102
|
+
download_vscode_extensions(
|
103
|
+
extensions_config,
|
104
|
+
target_platforms=[args.platform],
|
105
|
+
output=args.installer / "extensions",
|
106
|
+
)
|
107
|
+
|
108
|
+
|
109
|
+
def cmd_download_all(args: Namespace) -> None:
|
110
|
+
if args.code_version is None:
|
111
|
+
args.code_version = get_default_code_version()
|
112
|
+
if args.code_version is None:
|
113
|
+
raise ValueError(
|
114
|
+
"Cannot determine version from `code --version`, please specify `--version` manually."
|
115
|
+
)
|
116
|
+
|
117
|
+
download_vscode_server(
|
118
|
+
args.code_version,
|
119
|
+
output=args.installer / f"server-{args.code_version.replace(':', '-')}",
|
120
|
+
platform=args.server_platform,
|
121
|
+
)
|
122
|
+
download_vscode_client(
|
123
|
+
args.code_version,
|
124
|
+
output=args.installer / f"client-{args.code_version.replace(':', '-')}",
|
125
|
+
platform=args.client_platform,
|
126
|
+
)
|
127
|
+
extensions_config = Path(args.extensions_config).expanduser()
|
128
|
+
download_vscode_extensions(
|
129
|
+
extensions_config,
|
130
|
+
target_platforms=[args.server_platform, args.client_platform],
|
131
|
+
output=args.installer / "extensions",
|
132
|
+
)
|
133
|
+
|
134
|
+
|
135
|
+
def make_argparser() -> ArgumentParser:
|
136
|
+
parent_parser = ArgumentParser(add_help=False)
|
137
|
+
|
138
|
+
parent_parser.add_argument(
|
139
|
+
"--installer",
|
140
|
+
type=Path,
|
141
|
+
default="./vscode-offline-installer",
|
142
|
+
help="The output directory for downloaded files. Also used as the installer directory.",
|
143
|
+
)
|
144
|
+
|
145
|
+
parser = ArgumentParser()
|
146
|
+
subparsers = parser.add_subparsers(required=True)
|
147
|
+
|
148
|
+
download_server_parser = subparsers.add_parser(
|
149
|
+
"download-server",
|
150
|
+
help="Download VS Code Server and extensions",
|
151
|
+
parents=[parent_parser],
|
152
|
+
)
|
153
|
+
download_server_parser.set_defaults(func=cmd_download_server)
|
154
|
+
download_server_parser.add_argument(
|
155
|
+
"--code-version",
|
156
|
+
type=str,
|
157
|
+
help="The version of the VS Code Server to download, must match the version of the VS Code Client.",
|
158
|
+
)
|
159
|
+
download_server_parser.add_argument(
|
160
|
+
"--platform",
|
161
|
+
type=str,
|
162
|
+
required=True,
|
163
|
+
help="The target platform of the VS Code Server to download.",
|
164
|
+
)
|
165
|
+
download_server_parser.add_argument(
|
166
|
+
"--extensions-config",
|
167
|
+
type=Path,
|
168
|
+
default=get_vscode_extensions_config(),
|
169
|
+
help="Path to the extensions configuration file. Will search for extensions to download.",
|
170
|
+
)
|
171
|
+
|
172
|
+
install_server_parser = subparsers.add_parser(
|
173
|
+
"install-server",
|
174
|
+
help="Install VS Code Server and extensions",
|
175
|
+
parents=[parent_parser],
|
176
|
+
)
|
177
|
+
install_server_parser.set_defaults(func=cmd_install_server)
|
178
|
+
install_server_parser.add_argument(
|
179
|
+
"--code-version",
|
180
|
+
type=str,
|
181
|
+
help="The version of the VS Code Server to install.",
|
182
|
+
)
|
183
|
+
|
184
|
+
download_extensions_parser = subparsers.add_parser(
|
185
|
+
"download-extensions",
|
186
|
+
help="Download VS Code Server and extensions",
|
187
|
+
parents=[parent_parser],
|
188
|
+
)
|
189
|
+
download_extensions_parser.set_defaults(func=cmd_download_extensions)
|
190
|
+
download_extensions_parser.add_argument(
|
191
|
+
"--platform",
|
192
|
+
type=str,
|
193
|
+
required=True,
|
194
|
+
help="The target platform of the VS Code extensions to download.",
|
195
|
+
)
|
196
|
+
download_extensions_parser.add_argument(
|
197
|
+
"--extensions-config",
|
198
|
+
type=Path,
|
199
|
+
default=get_vscode_extensions_config(),
|
200
|
+
help="Path to the extensions configuration file. Will search for extensions to download.",
|
201
|
+
)
|
202
|
+
|
203
|
+
install_extensions_parser = subparsers.add_parser(
|
204
|
+
"install-extensions",
|
205
|
+
help="Install VS Code extensions",
|
206
|
+
parents=[parent_parser],
|
207
|
+
)
|
208
|
+
install_extensions_parser.set_defaults(func=cmd_install_extensions)
|
209
|
+
install_extensions_parser.add_argument(
|
210
|
+
"--code",
|
211
|
+
type=str,
|
212
|
+
default="code",
|
213
|
+
help="Path to the `code` binary.",
|
214
|
+
)
|
215
|
+
|
216
|
+
download_client_parser = subparsers.add_parser(
|
217
|
+
"download-client",
|
218
|
+
help="Download VS Code and extensions",
|
219
|
+
parents=[parent_parser],
|
220
|
+
)
|
221
|
+
download_client_parser.set_defaults(func=cmd_download_client)
|
222
|
+
download_client_parser.add_argument(
|
223
|
+
"--code-version",
|
224
|
+
type=str,
|
225
|
+
help="The version of the VS Code to download, must match the version of the VS Code Client.",
|
226
|
+
)
|
227
|
+
download_client_parser.add_argument(
|
228
|
+
"--platform",
|
229
|
+
type=str,
|
230
|
+
required=True,
|
231
|
+
help="The target platform of the VS Code to download.",
|
232
|
+
)
|
233
|
+
download_client_parser.add_argument(
|
234
|
+
"--extensions-config",
|
235
|
+
type=Path,
|
236
|
+
default=get_vscode_extensions_config(),
|
237
|
+
help="Path to the extensions configuration file. Will search for extensions to download.",
|
238
|
+
)
|
239
|
+
|
240
|
+
download_all_parser = subparsers.add_parser(
|
241
|
+
"download-all",
|
242
|
+
help="Download VS Code server, client and extensions, all in one command",
|
243
|
+
parents=[parent_parser],
|
244
|
+
)
|
245
|
+
download_all_parser.set_defaults(func=cmd_download_all)
|
246
|
+
download_all_parser.add_argument(
|
247
|
+
"--code-version",
|
248
|
+
type=str,
|
249
|
+
help="The version of the VS Code to download, defaults to `code --version` at current environment.",
|
250
|
+
)
|
251
|
+
download_all_parser.add_argument(
|
252
|
+
"--server-platform",
|
253
|
+
type=str,
|
254
|
+
default="linux-x64",
|
255
|
+
help="The target platform of the VS Code Server to download, defaults to linux-x64.",
|
256
|
+
)
|
257
|
+
download_all_parser.add_argument(
|
258
|
+
"--client-platform",
|
259
|
+
type=str,
|
260
|
+
default="win32-x64",
|
261
|
+
help="The target platform of the VS Code to download, defaults to win32-x64.",
|
262
|
+
)
|
263
|
+
download_all_parser.add_argument(
|
264
|
+
"--extensions-config",
|
265
|
+
type=Path,
|
266
|
+
default=get_vscode_extensions_config(),
|
267
|
+
help="Path to the extensions configuration file. Will search for extensions to download.",
|
268
|
+
)
|
269
|
+
|
270
|
+
return parser
|
271
|
+
|
272
|
+
|
273
|
+
def main() -> None:
|
274
|
+
logging.basicConfig(level=logging.INFO)
|
275
|
+
parser = make_argparser()
|
276
|
+
args = parser.parse_args()
|
277
|
+
args.func(args)
|
278
|
+
|
279
|
+
|
280
|
+
if __name__ == "__main__":
|
281
|
+
main()
|