sharex-cli 0.0.1__tar.gz → 0.0.3__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.1 → sharex_cli-0.0.3}/.gitignore +1 -0
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/PKG-INFO +36 -33
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/README.md +35 -32
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/pyproject.toml +32 -6
- sharex_cli-0.0.3/src/app.py +5 -0
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/src/sharex/_version.py +1 -1
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/src/sharex/api.py +9 -6
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/src/sharex/cli.py +2 -2
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/LICENSE +0 -0
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/src/sharex/__init__.py +0 -0
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/src/sharex/py.typed +0 -0
- {sharex_cli-0.0.1 → sharex_cli-0.0.3}/src/sharex/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sharex-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
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
|
|
@@ -54,16 +54,16 @@ Description-Content-Type: text/markdown
|
|
|
54
54
|
|
|
55
55
|
- [Features](#features)
|
|
56
56
|
- [Install](#install)
|
|
57
|
-
- [
|
|
57
|
+
- [Configure](#configure)
|
|
58
58
|
- [Usage](#usage)
|
|
59
59
|
- [Support](#support)
|
|
60
60
|
- [Contributing](#contributing)
|
|
61
61
|
|
|
62
|
-
Command Line Interface to Upload Files to a ShareX Server using a ShareX Custom Uploader `.sxcu` configuration
|
|
62
|
+
Command Line Interface to Upload Files to a ShareX Server using a ShareX Custom Uploader `.sxcu` configuration.
|
|
63
63
|
|
|
64
64
|
Upload any file, multiple files, directories, use globs, create archives and much more...
|
|
65
65
|
|
|
66
|
-
To get started [Install](#install) the app and view the [Usage](#usage).
|
|
66
|
+
To get started [Install](#install) the app, [Configure](#configure) your server and view the [Usage](#usage).
|
|
67
67
|
|
|
68
68
|
If you run into any issues or have any questions, [support](#support) is available.
|
|
69
69
|
|
|
@@ -89,80 +89,83 @@ From PyPI: <https://pypi.org/p/sharex-cli>
|
|
|
89
89
|
pip install sharex-cli
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
```shell
|
|
93
|
+
uv tool install sharex-cli
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
From GitHub: [https://github.com/cssnr/sharex-cli](https://github.com/cssnr/sharex-cli?tab=readme-ov-file#readme)
|
|
93
97
|
|
|
94
98
|
```shell
|
|
95
99
|
pip install git+https://github.com/cssnr/sharex-cli.git
|
|
96
100
|
```
|
|
97
101
|
|
|
98
|
-
From source.
|
|
99
|
-
|
|
100
102
|
```shell
|
|
101
|
-
|
|
102
|
-
pip install sharex-cli
|
|
103
|
+
uv tool install git+https://github.com/cssnr/sharex-cli.git
|
|
103
104
|
```
|
|
104
105
|
|
|
105
106
|
[](https://cssnr.github.io/sharex-cli/cli/#install)
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
Download a Binary: https://github.com/cssnr/sharex-cli/releases/latest
|
|
109
|
+
|
|
110
|
+
- [windows-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/windows-amd64.zip)
|
|
111
|
+
- [macos-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/macos-amd64.zip)
|
|
112
|
+
- [linux-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-amd64.zip)
|
|
113
|
+
- [linux-arm64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-arm64.zip)
|
|
114
|
+
|
|
115
|
+
## Configure<a id="configure"></a>
|
|
108
116
|
|
|
109
117
|
To configure you need your server's ShareX Custom Uploader `*.sxcu` configuration JSON.
|
|
110
118
|
|
|
111
|
-
The
|
|
119
|
+
The `--config` command allows you to enter the file path, or open a text editor.
|
|
112
120
|
|
|
113
121
|
```shell
|
|
114
|
-
sharex
|
|
122
|
+
sharex --config
|
|
115
123
|
```
|
|
116
124
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
You can reconfigure with `--config` and pass a path to the config file.
|
|
125
|
+
Or pass the config path directly to `--config`.
|
|
120
126
|
|
|
121
127
|
```shell
|
|
122
128
|
sharex --config path/to/config.sxcu
|
|
123
129
|
```
|
|
124
130
|
|
|
125
|
-
[](https://cssnr.github.io/sharex-cli/cli/#configure)
|
|
126
132
|
|
|
127
133
|
## Usage<a id="usage"></a>
|
|
128
134
|
|
|
129
|
-
|
|
135
|
+
To use run the `sharex` command with the path to the file to upload.
|
|
130
136
|
|
|
131
137
|
```shell
|
|
132
|
-
sharex
|
|
138
|
+
sharex file.txt
|
|
139
|
+
sharex file1.txt file2.txt
|
|
140
|
+
sharex file.txt -n name.txt
|
|
133
141
|
```
|
|
134
142
|
|
|
135
|
-
|
|
143
|
+
Directories can be uploaded as files using a glob (default `*`) or as an archive.
|
|
136
144
|
|
|
137
145
|
```shell
|
|
138
|
-
sharex dir1
|
|
146
|
+
sharex dir1 # non-recursive
|
|
147
|
+
sharex dir1 -g '**' # recursive
|
|
148
|
+
sharex dir1 -a # create an archive
|
|
139
149
|
```
|
|
140
150
|
|
|
141
|
-
|
|
151
|
+
Tip: you will be shown a confirmation before files are uploaded.
|
|
142
152
|
|
|
143
|
-
|
|
144
|
-
sharex /path/to/dir2 -a
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
[](https://cssnr.github.io/sharex-cli/cli/#uploading)
|
|
153
|
+
[](https://cssnr.github.io/sharex-cli/cli/#upload)
|
|
148
154
|
|
|
149
155
|
## Support<a id="support"></a>
|
|
150
156
|
|
|
151
|
-
|
|
157
|
+
If you run into any issues or need help getting started, please do one of the following:
|
|
152
158
|
|
|
159
|
+
- Report an Issue: <https://github.com/cssnr/sharex-cli/issues>
|
|
153
160
|
- Q&A Discussion: <https://github.com/cssnr/sharex-cli/discussions/categories/q-a>
|
|
154
161
|
- Request a Feature: <https://github.com/cssnr/sharex-cli/issues/new?template=1-feature.yaml>
|
|
155
|
-
-
|
|
156
|
-
|
|
157
|
-
If you are experiencing an issue/bug or getting unexpected results, you can:
|
|
158
|
-
|
|
159
|
-
- Report an Issue: <https://github.com/cssnr/sharex-cli/issues>
|
|
162
|
+
- Request Server Support: <https://github.com/cssnr/sharex-cli/issues/new?template=2-server.yaml>
|
|
160
163
|
- Chat with us on Discord: <https://discord.gg/wXy6m2X8wY>
|
|
161
164
|
|
|
162
165
|
[](https://github.com/cssnr/sharex-cli/issues/new?template=1-feature.yaml)
|
|
163
166
|
[](https://github.com/cssnr/sharex-cli/issues)
|
|
164
167
|
[](https://github.com/cssnr/sharex-cli/discussions)
|
|
165
|
-
[](https://discord.gg/wXy6m2X8wY)
|
|
166
169
|
|
|
167
170
|
## Contributing<a id="contributing"></a>
|
|
168
171
|
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
|
|
28
28
|
- [Features](#features)
|
|
29
29
|
- [Install](#install)
|
|
30
|
-
- [
|
|
30
|
+
- [Configure](#configure)
|
|
31
31
|
- [Usage](#usage)
|
|
32
32
|
- [Support](#support)
|
|
33
33
|
- [Contributing](#contributing)
|
|
34
34
|
|
|
35
|
-
Command Line Interface to Upload Files to a ShareX Server using a ShareX Custom Uploader `.sxcu` configuration
|
|
35
|
+
Command Line Interface to Upload Files to a ShareX Server using a ShareX Custom Uploader `.sxcu` configuration.
|
|
36
36
|
|
|
37
37
|
Upload any file, multiple files, directories, use globs, create archives and much more...
|
|
38
38
|
|
|
39
|
-
To get started [Install](#install) the app and view the [Usage](#usage).
|
|
39
|
+
To get started [Install](#install) the app, [Configure](#configure) your server and view the [Usage](#usage).
|
|
40
40
|
|
|
41
41
|
If you run into any issues or have any questions, [support](#support) is available.
|
|
42
42
|
|
|
@@ -62,80 +62,83 @@ From PyPI: <https://pypi.org/p/sharex-cli>
|
|
|
62
62
|
pip install sharex-cli
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
```shell
|
|
66
|
+
uv tool install sharex-cli
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
From GitHub: [https://github.com/cssnr/sharex-cli](https://github.com/cssnr/sharex-cli?tab=readme-ov-file#readme)
|
|
66
70
|
|
|
67
71
|
```shell
|
|
68
72
|
pip install git+https://github.com/cssnr/sharex-cli.git
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
From source.
|
|
72
|
-
|
|
73
75
|
```shell
|
|
74
|
-
|
|
75
|
-
pip install sharex-cli
|
|
76
|
+
uv tool install git+https://github.com/cssnr/sharex-cli.git
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
[](https://cssnr.github.io/sharex-cli/cli/#install)
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
Download a Binary: https://github.com/cssnr/sharex-cli/releases/latest
|
|
82
|
+
|
|
83
|
+
- [windows-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/windows-amd64.zip)
|
|
84
|
+
- [macos-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/macos-amd64.zip)
|
|
85
|
+
- [linux-amd64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-amd64.zip)
|
|
86
|
+
- [linux-arm64.zip](https://github.com/cssnr/sharex-cli/releases/latest/download/linux-arm64.zip)
|
|
87
|
+
|
|
88
|
+
## Configure<a id="configure"></a>
|
|
81
89
|
|
|
82
90
|
To configure you need your server's ShareX Custom Uploader `*.sxcu` configuration JSON.
|
|
83
91
|
|
|
84
|
-
The
|
|
92
|
+
The `--config` command allows you to enter the file path, or open a text editor.
|
|
85
93
|
|
|
86
94
|
```shell
|
|
87
|
-
sharex
|
|
95
|
+
sharex --config
|
|
88
96
|
```
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
You can reconfigure with `--config` and pass a path to the config file.
|
|
98
|
+
Or pass the config path directly to `--config`.
|
|
93
99
|
|
|
94
100
|
```shell
|
|
95
101
|
sharex --config path/to/config.sxcu
|
|
96
102
|
```
|
|
97
103
|
|
|
98
|
-
[](https://cssnr.github.io/sharex-cli/cli/#configure)
|
|
99
105
|
|
|
100
106
|
## Usage<a id="usage"></a>
|
|
101
107
|
|
|
102
|
-
|
|
108
|
+
To use run the `sharex` command with the path to the file to upload.
|
|
103
109
|
|
|
104
110
|
```shell
|
|
105
|
-
sharex
|
|
111
|
+
sharex file.txt
|
|
112
|
+
sharex file1.txt file2.txt
|
|
113
|
+
sharex file.txt -n name.txt
|
|
106
114
|
```
|
|
107
115
|
|
|
108
|
-
|
|
116
|
+
Directories can be uploaded as files using a glob (default `*`) or as an archive.
|
|
109
117
|
|
|
110
118
|
```shell
|
|
111
|
-
sharex dir1
|
|
119
|
+
sharex dir1 # non-recursive
|
|
120
|
+
sharex dir1 -g '**' # recursive
|
|
121
|
+
sharex dir1 -a # create an archive
|
|
112
122
|
```
|
|
113
123
|
|
|
114
|
-
|
|
124
|
+
Tip: you will be shown a confirmation before files are uploaded.
|
|
115
125
|
|
|
116
|
-
|
|
117
|
-
sharex /path/to/dir2 -a
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
[](https://cssnr.github.io/sharex-cli/cli/#uploading)
|
|
126
|
+
[](https://cssnr.github.io/sharex-cli/cli/#upload)
|
|
121
127
|
|
|
122
128
|
## Support<a id="support"></a>
|
|
123
129
|
|
|
124
|
-
|
|
130
|
+
If you run into any issues or need help getting started, please do one of the following:
|
|
125
131
|
|
|
132
|
+
- Report an Issue: <https://github.com/cssnr/sharex-cli/issues>
|
|
126
133
|
- Q&A Discussion: <https://github.com/cssnr/sharex-cli/discussions/categories/q-a>
|
|
127
134
|
- Request a Feature: <https://github.com/cssnr/sharex-cli/issues/new?template=1-feature.yaml>
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
If you are experiencing an issue/bug or getting unexpected results, you can:
|
|
131
|
-
|
|
132
|
-
- Report an Issue: <https://github.com/cssnr/sharex-cli/issues>
|
|
135
|
+
- Request Server Support: <https://github.com/cssnr/sharex-cli/issues/new?template=2-server.yaml>
|
|
133
136
|
- Chat with us on Discord: <https://discord.gg/wXy6m2X8wY>
|
|
134
137
|
|
|
135
138
|
[](https://github.com/cssnr/sharex-cli/issues/new?template=1-feature.yaml)
|
|
136
139
|
[](https://github.com/cssnr/sharex-cli/issues)
|
|
137
140
|
[](https://github.com/cssnr/sharex-cli/discussions)
|
|
138
|
-
[](https://discord.gg/wXy6m2X8wY)
|
|
139
142
|
|
|
140
143
|
## Contributing<a id="contributing"></a>
|
|
141
144
|
|
|
@@ -32,6 +32,7 @@ Issues = "https://github.com/cssnr/sharex-cli/issues"
|
|
|
32
32
|
|
|
33
33
|
[project.scripts]
|
|
34
34
|
sharex = "sharex.cli:app"
|
|
35
|
+
sharex-cli = "sharex.cli:app"
|
|
35
36
|
|
|
36
37
|
[dependency-groups]
|
|
37
38
|
dev = [
|
|
@@ -41,11 +42,14 @@ dev = [
|
|
|
41
42
|
"hatch>=1.16.2",
|
|
42
43
|
"isort>=7.0.0",
|
|
43
44
|
"mypy>=1.19.1",
|
|
45
|
+
"pyinstaller>=6.17.0",
|
|
46
|
+
"pyinstaller-versionfile>=3.0.1",
|
|
44
47
|
"pytest>=9.0.2",
|
|
45
|
-
"ruff>=0.14.
|
|
46
|
-
"tombi>=0.7.
|
|
47
|
-
"
|
|
48
|
-
"
|
|
48
|
+
"ruff>=0.14.10",
|
|
49
|
+
"tombi>=0.7.8",
|
|
50
|
+
"toml-run>=0.0.1",
|
|
51
|
+
"ty>=0.0.4",
|
|
52
|
+
"typer>=0.20.1",
|
|
49
53
|
"types-pyperclip>=1.9.0.20250801",
|
|
50
54
|
"types-requests>=2.32.4.20250913",
|
|
51
55
|
"validate-pyproject[all]>=0.24.1",
|
|
@@ -63,7 +67,7 @@ build-backend = "hatchling.build"
|
|
|
63
67
|
# Bandit
|
|
64
68
|
# https://bandit.readthedocs.io/en/latest/config.html
|
|
65
69
|
[tool.bandit]
|
|
66
|
-
exclude_dirs = [".venv"]
|
|
70
|
+
exclude_dirs = [".venv", "tests"]
|
|
67
71
|
skips = ["B105", "B107"]
|
|
68
72
|
|
|
69
73
|
# Black
|
|
@@ -75,7 +79,7 @@ extend-exclude = '(\.github)'
|
|
|
75
79
|
# Coverage
|
|
76
80
|
# https://coverage.readthedocs.io/en/latest/
|
|
77
81
|
[tool.coverage.run]
|
|
78
|
-
omit = ["_version.py", "utils.py", "cli.py"]
|
|
82
|
+
omit = ["_version.py", "app.py", "utils.py", "cli.py"]
|
|
79
83
|
source = ["src"]
|
|
80
84
|
|
|
81
85
|
# Hatchling
|
|
@@ -116,3 +120,25 @@ extend-exclude = [".github"]
|
|
|
116
120
|
|
|
117
121
|
[tool.ruff.lint]
|
|
118
122
|
select = ["E4", "E7", "E9", "F", "B", "Q"]
|
|
123
|
+
|
|
124
|
+
[tool.scripts]
|
|
125
|
+
version = "pyivf-make_version --source-format yaml --metadata-source .github/files/win-version.yaml --outfile win-version.txt"
|
|
126
|
+
install = "pyinstaller -F -n sharex -i docs/favicon.ico src/app.py"
|
|
127
|
+
build = "uv run hatch build"
|
|
128
|
+
predocs = "rm -rf .cache site"
|
|
129
|
+
docs = "zensical serve --open"
|
|
130
|
+
format = ["black .", "tombi format .", "ruff format ."]
|
|
131
|
+
lint = """
|
|
132
|
+
black --check .
|
|
133
|
+
run bandit
|
|
134
|
+
run mypy
|
|
135
|
+
run ruff
|
|
136
|
+
run validate
|
|
137
|
+
tombi lint .
|
|
138
|
+
ty check -v .
|
|
139
|
+
yamllint -c .github/yamllint.yaml .
|
|
140
|
+
"""
|
|
141
|
+
bandit = "bandit -c pyproject.toml -r ."
|
|
142
|
+
mypy = "mypy ."
|
|
143
|
+
ruff = "ruff check ."
|
|
144
|
+
validate = "validate-pyproject pyproject.toml"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# The string "0.0.1" is used in .github/workflows/build.yaml
|
|
2
|
-
__version__ = "0.0.
|
|
2
|
+
__version__ = "0.0.3"
|
|
@@ -17,7 +17,7 @@ session = requests.Session()
|
|
|
17
17
|
session.headers.update({"user-agent": f"requests/sharex-{__version__}"})
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def upload_file(config, file_name: str, file_data: IO) -> str:
|
|
20
|
+
def upload_file(config, file_name: str, file_data: IO, path: Optional[Path] = None) -> str:
|
|
21
21
|
"""Upload a File from an SXCU Config"""
|
|
22
22
|
url = config["RequestURL"]
|
|
23
23
|
# print(f"{url=}")
|
|
@@ -26,7 +26,7 @@ def upload_file(config, file_name: str, file_data: IO) -> str:
|
|
|
26
26
|
headers = config["Headers"]
|
|
27
27
|
key = config["URL"]
|
|
28
28
|
|
|
29
|
-
path = Path(file_name)
|
|
29
|
+
# path = Path(file_name)
|
|
30
30
|
mime_type = get_type(path)
|
|
31
31
|
# print(f"{mime_type=}")
|
|
32
32
|
|
|
@@ -71,7 +71,7 @@ def get_config(config_path: Optional[Path] = None, env_var: str = "", create_emp
|
|
|
71
71
|
return None
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
def get_type(
|
|
74
|
+
def get_type(path: Optional[Path] = None) -> str: # NOSONAR
|
|
75
75
|
"""
|
|
76
76
|
Get MIME type from guess_type or by reading magic headers
|
|
77
77
|
https://en.wikipedia.org/wiki/List_of_file_signatures
|
|
@@ -79,14 +79,17 @@ def get_type(file_path: Path) -> str: # NOSONAR
|
|
|
79
79
|
Deprecated since version 3.13: Passing a file path instead of URL is soft deprecated. Use guess_file_type() for this.
|
|
80
80
|
https://docs.python.org/3/library/mimetypes.html#mimetypes.guess_type
|
|
81
81
|
"""
|
|
82
|
-
|
|
82
|
+
if not path:
|
|
83
|
+
return "text/plain"
|
|
84
|
+
|
|
85
|
+
mime_type, _ = mimetypes.guess_type(path, strict=False)
|
|
83
86
|
if mime_type:
|
|
84
87
|
return mime_type
|
|
85
88
|
|
|
86
|
-
if not
|
|
89
|
+
if not path.is_file():
|
|
87
90
|
return "text/plain"
|
|
88
91
|
|
|
89
|
-
with open(
|
|
92
|
+
with open(path, "rb") as file:
|
|
90
93
|
chunk = file.read(512)
|
|
91
94
|
|
|
92
95
|
# print(f"chunk: {type(chunk)} - {chunk[:20]}")
|
|
@@ -124,7 +124,7 @@ def archive_dir(config, params: Dict[str, Any], dir_path: Path):
|
|
|
124
124
|
f"Uploading File: [green bold]{click.format_filename(final_path.name)}[/green bold] - [yellow bold]{size}"
|
|
125
125
|
):
|
|
126
126
|
with open(final_path, "rb") as f:
|
|
127
|
-
url = api.upload_file(config, final_path.name, f)
|
|
127
|
+
url = api.upload_file(config, final_path.name, f, final_path)
|
|
128
128
|
print(url)
|
|
129
129
|
copy_text(url)
|
|
130
130
|
raise typer.Exit()
|
|
@@ -263,7 +263,7 @@ def main( # NOSONAR
|
|
|
263
263
|
):
|
|
264
264
|
file_name = _name if _name and len(_files) == 1 else file.name
|
|
265
265
|
with open(file, "rb") as f:
|
|
266
|
-
url = api.upload_file(config, file_name, f)
|
|
266
|
+
url = api.upload_file(config, file_name, f, file)
|
|
267
267
|
print(url)
|
|
268
268
|
copy_text(url)
|
|
269
269
|
if _launch and len(_files) == 1 and url:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|