sharex-cli 0.0.2__tar.gz → 0.0.4__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.
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/.gitignore +7 -4
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/PKG-INFO +34 -21
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/README.md +27 -17
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/pyproject.toml +65 -19
- sharex_cli-0.0.4/src/app.py +4 -0
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/src/sharex/__init__.py +0 -1
- sharex_cli-0.0.4/src/sharex/_version.py +2 -0
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/src/sharex/api.py +9 -7
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/src/sharex/cli.py +5 -7
- sharex_cli-0.0.2/src/sharex/_version.py +0 -2
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/LICENSE +0 -0
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/src/sharex/py.typed +0 -0
- {sharex_cli-0.0.2 → sharex_cli-0.0.4}/src/sharex/utils.py +0 -0
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
.idea/
|
|
3
3
|
*.iml
|
|
4
4
|
.vscode/
|
|
5
|
+
.*cache*
|
|
6
|
+
node_modules/
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
out/
|
|
5
10
|
.venv/
|
|
6
11
|
venv/
|
|
7
12
|
__pycache__/
|
|
8
13
|
*.egg-info/
|
|
9
|
-
build/
|
|
10
|
-
dist/
|
|
11
|
-
.*cache/
|
|
12
|
-
*.log
|
|
13
14
|
*.pyc
|
|
14
15
|
.coverage
|
|
15
16
|
coverage.xml
|
|
@@ -17,3 +18,5 @@ coverage.xml
|
|
|
17
18
|
/site/
|
|
18
19
|
/tests/files
|
|
19
20
|
/tests/fake.json
|
|
21
|
+
*.spec
|
|
22
|
+
win-version.txt
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: sharex-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: CLI to Upload Files to a ShareX Server using a ShareX Custom Uploader (.sxcu) Configuration File.
|
|
5
5
|
Project-URL: Changelog, https://github.com/cssnr/sharex-cli/releases
|
|
6
6
|
Project-URL: Discord, https://discord.gg/wXy6m2X8wY
|
|
7
7
|
Project-URL: Documentation, https://cssnr.github.io/sharex-cli/
|
|
8
|
+
Project-URL: Download, https://github.com/cssnr/sharex-cli/releases/latest
|
|
8
9
|
Project-URL: Funding, https://ko-fi.com/cssnr
|
|
9
10
|
Project-URL: GitHub, https://github.com/cssnr/sharex-cli
|
|
10
11
|
Project-URL: Homepage, https://cssnr.com/
|
|
11
12
|
Project-URL: Issues, https://github.com/cssnr/sharex-cli/issues
|
|
12
13
|
Author: Shane
|
|
13
|
-
License: MIT
|
|
14
|
+
License-Expression: MIT
|
|
14
15
|
License-File: LICENSE
|
|
15
16
|
Classifier: Natural Language :: English
|
|
16
17
|
Classifier: Operating System :: OS Independent
|
|
@@ -19,31 +20,34 @@ Classifier: Programming Language :: Python :: 3
|
|
|
19
20
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
21
|
Classifier: Typing :: Typed
|
|
21
22
|
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: click<9,>=8
|
|
22
24
|
Requires-Dist: jsonpath-ng<2,>=1
|
|
23
25
|
Requires-Dist: pyperclip<2,>=1
|
|
24
26
|
Requires-Dist: requests<3,>=2
|
|
25
|
-
Requires-Dist:
|
|
27
|
+
Requires-Dist: rich>=13.8.0
|
|
28
|
+
Requires-Dist: typer>=0.27.2
|
|
26
29
|
Description-Content-Type: text/markdown
|
|
27
30
|
|
|
28
31
|
[](https://pypi.org/project/sharex-cli/)
|
|
29
32
|
[](https://github.com/cssnr/sharex-cli/releases)
|
|
30
33
|
[](https://github.com/cssnr/sharex-cli?tab=readme-ov-file#readme)
|
|
31
|
-
[](https://github.com/cssnr/sharex-cli/releases/latest)
|
|
35
|
+
[](https://pypistats.org/packages/sharex-cli)
|
|
36
|
+
[](https://clickpy.clickhouse.com/dashboard/sharex-cli)
|
|
33
37
|
[](https://codecov.io/gh/cssnr/sharex-cli)
|
|
34
38
|
[](https://github.com/cssnr/sharex-cli/actions/workflows/lint.yaml)
|
|
35
39
|
[](https://github.com/cssnr/sharex-cli/actions/workflows/test.yaml)
|
|
36
40
|
[](https://pypi.org/project/sharex-cli/)
|
|
37
41
|
[](https://cssnr.github.io/sharex-cli/)
|
|
38
|
-
[](https://github.com/cssnr/sharex-cli/pulse)
|
|
43
|
+
[](https://github.com/cssnr/sharex-cli?tab=readme-ov-file#readme)
|
|
44
|
+
[](https://github.com/cssnr/sharex-cli?tab=readme-ov-file#readme)
|
|
45
|
+
[](https://github.com/cssnr/sharex-cli/graphs/contributors)
|
|
46
|
+
[](https://github.com/cssnr/sharex-cli/issues)
|
|
47
|
+
[](https://github.com/cssnr/sharex-cli/discussions)
|
|
48
|
+
[](https://github.com/cssnr/sharex-cli/forks)
|
|
49
|
+
[](https://github.com/cssnr/sharex-cli/stargazers)
|
|
50
|
+
[](https://cssnr.github.io/)
|
|
47
51
|
[](https://discord.gg/wXy6m2X8wY)
|
|
48
52
|
[](https://ko-fi.com/cssnr)
|
|
49
53
|
|
|
@@ -87,22 +91,31 @@ From PyPI: <https://pypi.org/p/sharex-cli>
|
|
|
87
91
|
|
|
88
92
|
```shell
|
|
89
93
|
pip install sharex-cli
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
```shell
|
|
93
94
|
uv tool install sharex-cli
|
|
94
95
|
```
|
|
95
96
|
|
|
96
|
-
From
|
|
97
|
+
From Homebrew: <https://github.com/cssnr/homebrew-tap>
|
|
97
98
|
|
|
98
99
|
```shell
|
|
99
|
-
|
|
100
|
+
brew install cssnr/tap/sharex-cli
|
|
100
101
|
```
|
|
101
102
|
|
|
103
|
+
From GitHub: <https://github.com/cssnr/sharex-cli/releases/latest>
|
|
104
|
+
|
|
102
105
|
```shell
|
|
103
|
-
|
|
106
|
+
curl https://i.jpillora.com/cssnr/sharex-cli! | bash
|
|
104
107
|
```
|
|
105
108
|
|
|
109
|
+
See [jpillora/installer](https://github.com/jpillora/installer) for more details.
|
|
110
|
+
Alternatively, you can manually download a release for your system.
|
|
111
|
+
|
|
112
|
+
- [Windows Installer](https://github.com/cssnr/sharex-cli/releases/latest/download/windows-installer.exe) _amd64_
|
|
113
|
+
- [Windows x86_64](https://github.com/cssnr/sharex-cli/releases/latest/download/windows-amd64.zip) _amd64_
|
|
114
|
+
- [macOS Apple Intel](https://github.com/cssnr/sharex-cli/releases/latest/download/macos-amd64.zip) _amd64_
|
|
115
|
+
- [macOS Apple Silicon](https://github.com/cssnr/sharex-cli/releases/latest/download/macos-arm64.zip) _arm64_
|
|
116
|
+
- [Linux x86_64](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-amd64.zip) _amd64_
|
|
117
|
+
- [Linux ARM](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-arm64.zip) _arm64_
|
|
118
|
+
|
|
106
119
|
[](https://cssnr.github.io/sharex-cli/cli/#install)
|
|
107
120
|
|
|
108
121
|
## Configure<a id="configure"></a>
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
[](https://pypi.org/project/sharex-cli/)
|
|
2
2
|
[](https://github.com/cssnr/sharex-cli/releases)
|
|
3
3
|
[](https://github.com/cssnr/sharex-cli?tab=readme-ov-file#readme)
|
|
4
|
-
[](https://github.com/cssnr/sharex-cli/releases/latest)
|
|
5
|
+
[](https://pypistats.org/packages/sharex-cli)
|
|
6
|
+
[](https://clickpy.clickhouse.com/dashboard/sharex-cli)
|
|
6
7
|
[](https://codecov.io/gh/cssnr/sharex-cli)
|
|
7
8
|
[](https://github.com/cssnr/sharex-cli/actions/workflows/lint.yaml)
|
|
8
9
|
[](https://github.com/cssnr/sharex-cli/actions/workflows/test.yaml)
|
|
9
10
|
[](https://pypi.org/project/sharex-cli/)
|
|
10
11
|
[](https://cssnr.github.io/sharex-cli/)
|
|
11
|
-
[](https://github.com/cssnr/sharex-cli/pulse)
|
|
13
|
+
[](https://github.com/cssnr/sharex-cli?tab=readme-ov-file#readme)
|
|
14
|
+
[](https://github.com/cssnr/sharex-cli?tab=readme-ov-file#readme)
|
|
15
|
+
[](https://github.com/cssnr/sharex-cli/graphs/contributors)
|
|
16
|
+
[](https://github.com/cssnr/sharex-cli/issues)
|
|
17
|
+
[](https://github.com/cssnr/sharex-cli/discussions)
|
|
18
|
+
[](https://github.com/cssnr/sharex-cli/forks)
|
|
19
|
+
[](https://github.com/cssnr/sharex-cli/stargazers)
|
|
20
|
+
[](https://cssnr.github.io/)
|
|
20
21
|
[](https://discord.gg/wXy6m2X8wY)
|
|
21
22
|
[](https://ko-fi.com/cssnr)
|
|
22
23
|
|
|
@@ -60,22 +61,31 @@ From PyPI: <https://pypi.org/p/sharex-cli>
|
|
|
60
61
|
|
|
61
62
|
```shell
|
|
62
63
|
pip install sharex-cli
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
```shell
|
|
66
64
|
uv tool install sharex-cli
|
|
67
65
|
```
|
|
68
66
|
|
|
69
|
-
From
|
|
67
|
+
From Homebrew: <https://github.com/cssnr/homebrew-tap>
|
|
70
68
|
|
|
71
69
|
```shell
|
|
72
|
-
|
|
70
|
+
brew install cssnr/tap/sharex-cli
|
|
73
71
|
```
|
|
74
72
|
|
|
73
|
+
From GitHub: <https://github.com/cssnr/sharex-cli/releases/latest>
|
|
74
|
+
|
|
75
75
|
```shell
|
|
76
|
-
|
|
76
|
+
curl https://i.jpillora.com/cssnr/sharex-cli! | bash
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
See [jpillora/installer](https://github.com/jpillora/installer) for more details.
|
|
80
|
+
Alternatively, you can manually download a release for your system.
|
|
81
|
+
|
|
82
|
+
- [Windows Installer](https://github.com/cssnr/sharex-cli/releases/latest/download/windows-installer.exe) _amd64_
|
|
83
|
+
- [Windows x86_64](https://github.com/cssnr/sharex-cli/releases/latest/download/windows-amd64.zip) _amd64_
|
|
84
|
+
- [macOS Apple Intel](https://github.com/cssnr/sharex-cli/releases/latest/download/macos-amd64.zip) _amd64_
|
|
85
|
+
- [macOS Apple Silicon](https://github.com/cssnr/sharex-cli/releases/latest/download/macos-arm64.zip) _arm64_
|
|
86
|
+
- [Linux x86_64](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-amd64.zip) _amd64_
|
|
87
|
+
- [Linux ARM](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-arm64.zip) _arm64_
|
|
88
|
+
|
|
79
89
|
[](https://cssnr.github.io/sharex-cli/cli/#install)
|
|
80
90
|
|
|
81
91
|
## Configure<a id="configure"></a>
|
|
@@ -3,7 +3,7 @@ name = "sharex-cli"
|
|
|
3
3
|
description = "CLI to Upload Files to a ShareX Server using a ShareX Custom Uploader (.sxcu) Configuration File."
|
|
4
4
|
readme = "README.md"
|
|
5
5
|
requires-python = ">=3.10"
|
|
6
|
-
license =
|
|
6
|
+
license = "MIT"
|
|
7
7
|
authors = [{ name = "Shane" }]
|
|
8
8
|
classifiers = [
|
|
9
9
|
"Natural Language :: English",
|
|
@@ -14,10 +14,12 @@ classifiers = [
|
|
|
14
14
|
"Typing :: Typed",
|
|
15
15
|
]
|
|
16
16
|
dependencies = [
|
|
17
|
+
"click>=8,<9",
|
|
17
18
|
"jsonpath-ng>=1,<2",
|
|
18
19
|
"pyperclip>=1,<2",
|
|
19
20
|
"requests>=2,<3",
|
|
20
|
-
"
|
|
21
|
+
"rich>=13.8.0",
|
|
22
|
+
"typer>=0.27.2",
|
|
21
23
|
]
|
|
22
24
|
dynamic = ["version"]
|
|
23
25
|
|
|
@@ -25,6 +27,7 @@ dynamic = ["version"]
|
|
|
25
27
|
Changelog = "https://github.com/cssnr/sharex-cli/releases"
|
|
26
28
|
Discord = "https://discord.gg/wXy6m2X8wY"
|
|
27
29
|
Documentation = "https://cssnr.github.io/sharex-cli/"
|
|
30
|
+
Download = "https://github.com/cssnr/sharex-cli/releases/latest"
|
|
28
31
|
Funding = "https://ko-fi.com/cssnr"
|
|
29
32
|
GitHub = "https://github.com/cssnr/sharex-cli"
|
|
30
33
|
Homepage = "https://cssnr.com/"
|
|
@@ -36,20 +39,23 @@ sharex-cli = "sharex.cli:app"
|
|
|
36
39
|
|
|
37
40
|
[dependency-groups]
|
|
38
41
|
dev = [
|
|
39
|
-
"bandit>=1.9.
|
|
40
|
-
"black>=
|
|
41
|
-
"coverage>=7.
|
|
42
|
-
"hatch>=1.
|
|
43
|
-
"isort>=
|
|
44
|
-
"mypy>=
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
42
|
+
"bandit>=1.9.4",
|
|
43
|
+
"black>=26.5.1",
|
|
44
|
+
"coverage>=7.16.1",
|
|
45
|
+
"hatch>=1.18.1",
|
|
46
|
+
"isort>=9.0.1",
|
|
47
|
+
"mypy>=2.3.1",
|
|
48
|
+
"pyinstaller>=6.22.3",
|
|
49
|
+
"pyinstaller-versionfile>=3.1.0",
|
|
50
|
+
"pytest>=9.1.1",
|
|
51
|
+
"ruff>=0.16.8",
|
|
52
|
+
"tombi>=1.5.5",
|
|
53
|
+
"toml-run>=0.0.2",
|
|
54
|
+
"ty>=0.0.83",
|
|
55
|
+
"typer>=0.27.2",
|
|
56
|
+
"types-pyperclip>=1.11.0.20260508",
|
|
57
|
+
"types-requests>=2.33.0.20260906",
|
|
58
|
+
"validate-pyproject[all]>=0.26",
|
|
53
59
|
]
|
|
54
60
|
|
|
55
61
|
# [build-system]
|
|
@@ -64,7 +70,7 @@ build-backend = "hatchling.build"
|
|
|
64
70
|
# Bandit
|
|
65
71
|
# https://bandit.readthedocs.io/en/latest/config.html
|
|
66
72
|
[tool.bandit]
|
|
67
|
-
exclude_dirs = [".venv"]
|
|
73
|
+
exclude_dirs = [".venv", "tests"]
|
|
68
74
|
skips = ["B105", "B107"]
|
|
69
75
|
|
|
70
76
|
# Black
|
|
@@ -76,7 +82,7 @@ extend-exclude = '(\.github)'
|
|
|
76
82
|
# Coverage
|
|
77
83
|
# https://coverage.readthedocs.io/en/latest/
|
|
78
84
|
[tool.coverage.run]
|
|
79
|
-
omit = ["_version.py", "utils.py", "cli.py"]
|
|
85
|
+
omit = ["_version.py", "app.py", "utils.py", "cli.py"]
|
|
80
86
|
source = ["src"]
|
|
81
87
|
|
|
82
88
|
# Hatchling
|
|
@@ -94,7 +100,6 @@ packages = ["src/sharex"]
|
|
|
94
100
|
# https://pycqa.github.io/isort/docs/configuration/options.html
|
|
95
101
|
[tool.isort]
|
|
96
102
|
profile = "black"
|
|
97
|
-
lines_after_imports = 2
|
|
98
103
|
src_paths = ["src", "test"]
|
|
99
104
|
skip = [".venv", ".github"]
|
|
100
105
|
|
|
@@ -117,3 +122,44 @@ extend-exclude = [".github"]
|
|
|
117
122
|
|
|
118
123
|
[tool.ruff.lint]
|
|
119
124
|
select = ["E4", "E7", "E9", "F", "B", "Q"]
|
|
125
|
+
|
|
126
|
+
[tool.scripts]
|
|
127
|
+
win-version = "uv run pyivf-make_version --source-format yaml --metadata-source assets/win-version.yaml --outfile win-version.txt"
|
|
128
|
+
pyinstaller = "uv run pyinstaller -n sharex -i docs/favicon.ico src/app.py"
|
|
129
|
+
pathmgr = [
|
|
130
|
+
"mkdir dist || echo dist dir exists",
|
|
131
|
+
"wget https://github.com/Bill-Stewart/PathMgr/releases/download/v2.0.0/PathMgr-2.0.0.zip -O dist/pathmgr.zip",
|
|
132
|
+
"unzip dist/pathmgr.zip -d dist/PathMgr",
|
|
133
|
+
]
|
|
134
|
+
inno = ["iscc.exe installer.iss"]
|
|
135
|
+
test = ["uv run coverage run -m pytest", "uv run coverage report -m"]
|
|
136
|
+
clean = "rm -rf .cache dist site"
|
|
137
|
+
build = "uv run hatch build"
|
|
138
|
+
predocs = "rm -rf .cache site"
|
|
139
|
+
docs = "zensical serve --open --dev-addr 0.0.0.0:8000"
|
|
140
|
+
docs-build = "zensical build --clean"
|
|
141
|
+
format = [
|
|
142
|
+
"uv run black .",
|
|
143
|
+
"uv run isort -c .",
|
|
144
|
+
"uv run ruff format .",
|
|
145
|
+
"uv run tombi format .",
|
|
146
|
+
"which prettier && prettier --write . || echo missing prettier",
|
|
147
|
+
]
|
|
148
|
+
lint = [
|
|
149
|
+
"run bandit",
|
|
150
|
+
"run mypy",
|
|
151
|
+
"run ruff",
|
|
152
|
+
"run validate",
|
|
153
|
+
"run yamllint",
|
|
154
|
+
"which prettier && prettier --check . || echo missing prettier",
|
|
155
|
+
"uv run black --check .",
|
|
156
|
+
"uv run isort -c .",
|
|
157
|
+
"uv run tombi lint",
|
|
158
|
+
"uv run ty check -v .",
|
|
159
|
+
"uv lock --check",
|
|
160
|
+
]
|
|
161
|
+
bandit = "uv run bandit -c pyproject.toml -r ."
|
|
162
|
+
mypy = "uv run mypy ."
|
|
163
|
+
ruff = "uv run ruff check ."
|
|
164
|
+
validate = "uv run validate-pyproject pyproject.toml"
|
|
165
|
+
yamllint = "uv run yamllint -c .github/yamllint.yaml ."
|
|
@@ -11,13 +11,12 @@ from jsonpath_ng.ext import parse
|
|
|
11
11
|
|
|
12
12
|
from ._version import __version__
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
session = requests.Session()
|
|
16
15
|
|
|
17
16
|
session.headers.update({"user-agent": f"requests/sharex-{__version__}"})
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
def upload_file(config, file_name: str, file_data: IO) -> str:
|
|
19
|
+
def upload_file(config, file_name: str, file_data: IO, path: Optional[Path] = None) -> str:
|
|
21
20
|
"""Upload a File from an SXCU Config"""
|
|
22
21
|
url = config["RequestURL"]
|
|
23
22
|
# print(f"{url=}")
|
|
@@ -26,7 +25,7 @@ def upload_file(config, file_name: str, file_data: IO) -> str:
|
|
|
26
25
|
headers = config["Headers"]
|
|
27
26
|
key = config["URL"]
|
|
28
27
|
|
|
29
|
-
path = Path(file_name)
|
|
28
|
+
# path = Path(file_name)
|
|
30
29
|
mime_type = get_type(path)
|
|
31
30
|
# print(f"{mime_type=}")
|
|
32
31
|
|
|
@@ -71,7 +70,7 @@ def get_config(config_path: Optional[Path] = None, env_var: str = "", create_emp
|
|
|
71
70
|
return None
|
|
72
71
|
|
|
73
72
|
|
|
74
|
-
def get_type(
|
|
73
|
+
def get_type(path: Optional[Path] = None) -> str: # NOSONAR
|
|
75
74
|
"""
|
|
76
75
|
Get MIME type from guess_type or by reading magic headers
|
|
77
76
|
https://en.wikipedia.org/wiki/List_of_file_signatures
|
|
@@ -79,14 +78,17 @@ def get_type(file_path: Path) -> str: # NOSONAR
|
|
|
79
78
|
Deprecated since version 3.13: Passing a file path instead of URL is soft deprecated. Use guess_file_type() for this.
|
|
80
79
|
https://docs.python.org/3/library/mimetypes.html#mimetypes.guess_type
|
|
81
80
|
"""
|
|
82
|
-
|
|
81
|
+
if not path:
|
|
82
|
+
return "text/plain"
|
|
83
|
+
|
|
84
|
+
mime_type, _ = mimetypes.guess_type(path, strict=False)
|
|
83
85
|
if mime_type:
|
|
84
86
|
return mime_type
|
|
85
87
|
|
|
86
|
-
if not
|
|
88
|
+
if not path.is_file():
|
|
87
89
|
return "text/plain"
|
|
88
90
|
|
|
89
|
-
with open(
|
|
91
|
+
with open(path, "rb") as file:
|
|
90
92
|
chunk = file.read(512)
|
|
91
93
|
|
|
92
94
|
# print(f"chunk: {type(chunk)} - {chunk[:20]}")
|
|
@@ -5,7 +5,7 @@ import sys
|
|
|
5
5
|
import tempfile
|
|
6
6
|
from json import JSONDecodeError
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
from typing import Any, Dict, List, Optional
|
|
8
|
+
from typing import Annotated, Any, Dict, List, Optional, cast
|
|
9
9
|
|
|
10
10
|
import click
|
|
11
11
|
import pyperclip
|
|
@@ -14,13 +14,11 @@ from rich import print
|
|
|
14
14
|
from rich.console import Console
|
|
15
15
|
from rich.panel import Panel
|
|
16
16
|
from rich.table import Table
|
|
17
|
-
from typing_extensions import Annotated
|
|
18
17
|
|
|
19
18
|
from . import __doc__ as package_doc
|
|
20
19
|
from . import api, utils
|
|
21
20
|
from ._version import __version__
|
|
22
21
|
|
|
23
|
-
|
|
24
22
|
app = typer.Typer(
|
|
25
23
|
context_settings={"help_option_names": ["-h", "--help"]},
|
|
26
24
|
pretty_exceptions_show_locals=False,
|
|
@@ -79,7 +77,7 @@ def update_config(config_path: Path, config_files: List[Path]):
|
|
|
79
77
|
vprint(f"2 {user_config=}")
|
|
80
78
|
|
|
81
79
|
if not user_config:
|
|
82
|
-
res
|
|
80
|
+
res = cast(Optional[str], click.edit())
|
|
83
81
|
vprint(f"{res=}")
|
|
84
82
|
if res:
|
|
85
83
|
user_config = json.loads(res)
|
|
@@ -124,7 +122,7 @@ def archive_dir(config, params: Dict[str, Any], dir_path: Path):
|
|
|
124
122
|
f"Uploading File: [green bold]{click.format_filename(final_path.name)}[/green bold] - [yellow bold]{size}"
|
|
125
123
|
):
|
|
126
124
|
with open(final_path, "rb") as f:
|
|
127
|
-
url = api.upload_file(config, final_path.name, f)
|
|
125
|
+
url = api.upload_file(config, final_path.name, f, final_path)
|
|
128
126
|
print(url)
|
|
129
127
|
copy_text(url)
|
|
130
128
|
raise typer.Exit()
|
|
@@ -209,7 +207,7 @@ def main( # NOSONAR
|
|
|
209
207
|
# Process STDIN
|
|
210
208
|
file_name = _name or f"{utils.gen_rand(8)}.txt"
|
|
211
209
|
vprint(f"{file_name=}")
|
|
212
|
-
content =
|
|
210
|
+
content = sys.stdin
|
|
213
211
|
url = api.upload_file(config, file_name, content)
|
|
214
212
|
print(url)
|
|
215
213
|
copy_text(url)
|
|
@@ -263,7 +261,7 @@ def main( # NOSONAR
|
|
|
263
261
|
):
|
|
264
262
|
file_name = _name if _name and len(_files) == 1 else file.name
|
|
265
263
|
with open(file, "rb") as f:
|
|
266
|
-
url = api.upload_file(config, file_name, f)
|
|
264
|
+
url = api.upload_file(config, file_name, f, file)
|
|
267
265
|
print(url)
|
|
268
266
|
copy_text(url)
|
|
269
267
|
if _launch and len(_files) == 1 and url:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|