efs-cli 1.0.0__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.
- efs_cli-1.0.0/LICENSE +9 -0
- efs_cli-1.0.0/PKG-INFO +80 -0
- efs_cli-1.0.0/README.md +58 -0
- efs_cli-1.0.0/pyproject.toml +38 -0
- efs_cli-1.0.0/setup.cfg +4 -0
- efs_cli-1.0.0/src/efs_cli/__init__.py +2 -0
- efs_cli-1.0.0/src/efs_cli/cli.py +119 -0
- efs_cli-1.0.0/src/efs_cli.egg-info/PKG-INFO +80 -0
- efs_cli-1.0.0/src/efs_cli.egg-info/SOURCES.txt +11 -0
- efs_cli-1.0.0/src/efs_cli.egg-info/dependency_links.txt +1 -0
- efs_cli-1.0.0/src/efs_cli.egg-info/entry_points.txt +2 -0
- efs_cli-1.0.0/src/efs_cli.egg-info/requires.txt +2 -0
- efs_cli-1.0.0/src/efs_cli.egg-info/top_level.txt +1 -0
efs_cli-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 maxeepy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
efs_cli-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: efs-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: EepyFileServer API CLI written in Python
|
|
5
|
+
Author: maxie
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://codeberg.org/maxeepy/eepyfileserver-cli
|
|
8
|
+
Project-URL: Issues, https://codeberg.org/maxeepy/eepyfileserver-cli/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: requests>=2.30
|
|
20
|
+
Requires-Dist: efs-wrapper
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# eepyfileserver-cli
|
|
24
|
+
|
|
25
|
+
command line interface for eepyfileserver written in python
|
|
26
|
+
|
|
27
|
+
## prerequisites
|
|
28
|
+
|
|
29
|
+
- python 3.10 (3.12+ required)
|
|
30
|
+
- [`eepyfileserver`](https://codeberg.org/maxeepy/eepyfileserver) 1.1.0-alpha or later
|
|
31
|
+
|
|
32
|
+
## install
|
|
33
|
+
|
|
34
|
+
`pip install efs-cli`
|
|
35
|
+
|
|
36
|
+
## usage
|
|
37
|
+
|
|
38
|
+
### log in to an instance
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
#login fully (lets you upload and download files)
|
|
42
|
+
#password is saved in PLAIN TEXT
|
|
43
|
+
python3 eepyfileserver.py instance "https://example.com" "password123"
|
|
44
|
+
|
|
45
|
+
#login only using the url (lets you download PUBLIC files)
|
|
46
|
+
python3 eepyfileserver.py instance "https://example.com"
|
|
47
|
+
|
|
48
|
+
python3 eepyfileserver.py login ...
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### list files
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python3 eepyfileserver.py list
|
|
55
|
+
python3 eepyfileserver.py ls
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### download a file
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python3 eepyfileserver.py download /example.txt /home/maxeepy/Downloads/example.txt
|
|
62
|
+
python3 eepyfileserver.py get ...
|
|
63
|
+
python3 eepyfileserver.py d ...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### upload a file
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python3 eepyfileserver.py upload /home/maxeepy/Downloads/example.txt /example.txt
|
|
70
|
+
python3 eepyfileserver.py post ...
|
|
71
|
+
python3 eepyfileserver.py up ...
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### delete a file
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python3 eepyfileserver.py delete /example.txt
|
|
78
|
+
python3 eepyfileserver.py remove ...
|
|
79
|
+
python3 eepyfileserver.py rm ...
|
|
80
|
+
```
|
efs_cli-1.0.0/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# eepyfileserver-cli
|
|
2
|
+
|
|
3
|
+
command line interface for eepyfileserver written in python
|
|
4
|
+
|
|
5
|
+
## prerequisites
|
|
6
|
+
|
|
7
|
+
- python 3.10 (3.12+ required)
|
|
8
|
+
- [`eepyfileserver`](https://codeberg.org/maxeepy/eepyfileserver) 1.1.0-alpha or later
|
|
9
|
+
|
|
10
|
+
## install
|
|
11
|
+
|
|
12
|
+
`pip install efs-cli`
|
|
13
|
+
|
|
14
|
+
## usage
|
|
15
|
+
|
|
16
|
+
### log in to an instance
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
#login fully (lets you upload and download files)
|
|
20
|
+
#password is saved in PLAIN TEXT
|
|
21
|
+
python3 eepyfileserver.py instance "https://example.com" "password123"
|
|
22
|
+
|
|
23
|
+
#login only using the url (lets you download PUBLIC files)
|
|
24
|
+
python3 eepyfileserver.py instance "https://example.com"
|
|
25
|
+
|
|
26
|
+
python3 eepyfileserver.py login ...
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### list files
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python3 eepyfileserver.py list
|
|
33
|
+
python3 eepyfileserver.py ls
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### download a file
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
python3 eepyfileserver.py download /example.txt /home/maxeepy/Downloads/example.txt
|
|
40
|
+
python3 eepyfileserver.py get ...
|
|
41
|
+
python3 eepyfileserver.py d ...
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### upload a file
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python3 eepyfileserver.py upload /home/maxeepy/Downloads/example.txt /example.txt
|
|
48
|
+
python3 eepyfileserver.py post ...
|
|
49
|
+
python3 eepyfileserver.py up ...
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### delete a file
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python3 eepyfileserver.py delete /example.txt
|
|
56
|
+
python3 eepyfileserver.py remove ...
|
|
57
|
+
python3 eepyfileserver.py rm ...
|
|
58
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3", "requests >= 2.30", "efs-wrapper"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "efs-cli"
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "maxie" }
|
|
9
|
+
]
|
|
10
|
+
description = "EepyFileServer API CLI written in Python"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"requests >= 2.30",
|
|
15
|
+
"efs-wrapper"
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Operating System :: POSIX :: Linux"
|
|
25
|
+
]
|
|
26
|
+
license = "MIT"
|
|
27
|
+
license-files = ["LICEN[CS]E*"]
|
|
28
|
+
dynamic = ["version"]
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.dynamic]
|
|
31
|
+
version = { attr = "efs_cli.__version__" }
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://codeberg.org/maxeepy/eepyfileserver-cli"
|
|
35
|
+
Issues = "https://codeberg.org/maxeepy/eepyfileserver-cli/issues"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
efs-cli = "efs_cli.cli:main"
|
efs_cli-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
from . import __version__ as version
|
|
2
|
+
from efs_wrapper import __version__ as wrapper_version
|
|
3
|
+
from efs_wrapper.v1 import EepyFileServer, EepyFileServerPublic
|
|
4
|
+
from argparse import ArgumentParser
|
|
5
|
+
import os
|
|
6
|
+
import json
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
CONFIG_PATH = os.path.expanduser("~/.efs-cli_config.json")
|
|
10
|
+
if os.path.exists(os.path.expanduser("~/.config/")):
|
|
11
|
+
CONFIG_PATH = os.path.expanduser("~/.config/efs-cli.json")
|
|
12
|
+
|
|
13
|
+
def get_conf():
|
|
14
|
+
conf = None
|
|
15
|
+
|
|
16
|
+
if os.path.exists(CONFIG_PATH):
|
|
17
|
+
with open(CONFIG_PATH, "r") as file:
|
|
18
|
+
conf = json.load(file)
|
|
19
|
+
|
|
20
|
+
return conf
|
|
21
|
+
|
|
22
|
+
def init_api():
|
|
23
|
+
conf = get_conf()
|
|
24
|
+
|
|
25
|
+
if conf is None:
|
|
26
|
+
print("Please authorize with 'efs-cli auth <base_url> <password>'")
|
|
27
|
+
sys.exit(1)
|
|
28
|
+
|
|
29
|
+
base_url = conf.get("base_url")
|
|
30
|
+
password = conf.get("password", None)
|
|
31
|
+
efs = EepyFileServerPublic(base_url) if password is None else EepyFileServer(base_url, password)
|
|
32
|
+
return efs
|
|
33
|
+
|
|
34
|
+
def auth(base_url, password, **__):
|
|
35
|
+
data = {"base_url": base_url, "password": password}
|
|
36
|
+
with open(CONFIG_PATH, "w") as file:
|
|
37
|
+
json.dump(data, file)
|
|
38
|
+
print("Saved eepyfileserver password and base url in config.json")
|
|
39
|
+
|
|
40
|
+
def download(from_path, to_path, **__):
|
|
41
|
+
api = init_api()
|
|
42
|
+
file = api.get_file(from_path)
|
|
43
|
+
file.fetch_file().save(to_path)
|
|
44
|
+
print(f"Downloaded {from_path} to {to_path}")
|
|
45
|
+
|
|
46
|
+
def read(file_path, **__):
|
|
47
|
+
api = init_api()
|
|
48
|
+
file = api.get_file(file_path)
|
|
49
|
+
print(file.fetch_file().load().decode("utf-8"))
|
|
50
|
+
|
|
51
|
+
def upload(from_path, to_path, **__):
|
|
52
|
+
api = init_api()
|
|
53
|
+
if hasattr(api, "upload_file"):
|
|
54
|
+
with open(from_path, "rb") as file:
|
|
55
|
+
api.upload_file(to_path, file)
|
|
56
|
+
print(f"Uploaded {from_path} to {to_path}")
|
|
57
|
+
else:
|
|
58
|
+
print("Login using 'efs-cli auth <base url> <password>' to upload files")
|
|
59
|
+
sys.exit(1)
|
|
60
|
+
|
|
61
|
+
def list_files(**__):
|
|
62
|
+
api = init_api()
|
|
63
|
+
print(api.get_filelist())
|
|
64
|
+
|
|
65
|
+
def remove(file_path, **__):
|
|
66
|
+
api = init_api()
|
|
67
|
+
if hasattr(api, "delete_file"):
|
|
68
|
+
api.delete_file(file_path)
|
|
69
|
+
print(f"Deleted {file_path}")
|
|
70
|
+
else:
|
|
71
|
+
print("Login using 'efs-cli auth <base url> <password>' to delete files")
|
|
72
|
+
return 1
|
|
73
|
+
|
|
74
|
+
def ver(**__):
|
|
75
|
+
conf = get_conf()
|
|
76
|
+
print(f"efs-cli: {version}")
|
|
77
|
+
print(f"efs-wrapper: {wrapper_version}")
|
|
78
|
+
if conf and conf.get("base_url"):
|
|
79
|
+
api = init_api()
|
|
80
|
+
print(f"EepyFileServer: {api.get_instance_info()['instance']['version']}")
|
|
81
|
+
|
|
82
|
+
def main():
|
|
83
|
+
parser = ArgumentParser("efs-cli", description="eepyfileserver cli tool for downloading and uploading files")
|
|
84
|
+
subparser = parser.add_subparsers()
|
|
85
|
+
|
|
86
|
+
auth_parser = subparser.add_parser("auth", help="authorize to eepyfileserver", aliases=["login"])
|
|
87
|
+
auth_parser.add_argument("base_url", help="the base url of your eepyfileserver instance")
|
|
88
|
+
auth_parser.add_argument("password", nargs="?", help="password to login in your eepyfileserver instance", default=None)
|
|
89
|
+
auth_parser.set_defaults(func=auth)
|
|
90
|
+
|
|
91
|
+
download_parser = subparser.add_parser("download", help="download a file", aliases=["get", "d"])
|
|
92
|
+
download_parser.add_argument("from_path", help="the efs path of the file to download")
|
|
93
|
+
download_parser.add_argument("to_path", help="the local path to download the file to")
|
|
94
|
+
download_parser.set_defaults(func=download)
|
|
95
|
+
|
|
96
|
+
read_parser = subparser.add_parser("read", help="read a file", aliases=["cat"])
|
|
97
|
+
read_parser.add_argument("file_path", help="the efs path of the file to read")
|
|
98
|
+
read_parser.set_defaults(func=read)
|
|
99
|
+
|
|
100
|
+
upload_parser = subparser.add_parser("upload", help="upload a file", aliases=["post", "up", "put"])
|
|
101
|
+
upload_parser.add_argument("from_path", help="the local path of the file to upload")
|
|
102
|
+
upload_parser.add_argument("to_path", help="the efs path to upload the file to")
|
|
103
|
+
upload_parser.set_defaults(func=upload)
|
|
104
|
+
|
|
105
|
+
list_files_parser = subparser.add_parser("list", help="list current files on efs", aliases=["ls", "files"])
|
|
106
|
+
list_files_parser.set_defaults(func=list_files)
|
|
107
|
+
|
|
108
|
+
remove_parser = subparser.add_parser("delete", help="delete a file", aliases=["remove", "rm"])
|
|
109
|
+
remove_parser.add_argument("file_path")
|
|
110
|
+
remove_parser.set_defaults(func=remove)
|
|
111
|
+
|
|
112
|
+
version_parser = subparser.add_parser("version", help="view efs-cli and dependencies versions", aliases=["ver"])
|
|
113
|
+
version_parser.set_defaults(func=ver)
|
|
114
|
+
|
|
115
|
+
args = parser.parse_args()
|
|
116
|
+
args.func(**vars(args))
|
|
117
|
+
|
|
118
|
+
if __name__ == "__main__":
|
|
119
|
+
main()
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: efs-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: EepyFileServer API CLI written in Python
|
|
5
|
+
Author: maxie
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://codeberg.org/maxeepy/eepyfileserver-cli
|
|
8
|
+
Project-URL: Issues, https://codeberg.org/maxeepy/eepyfileserver-cli/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: requests>=2.30
|
|
20
|
+
Requires-Dist: efs-wrapper
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# eepyfileserver-cli
|
|
24
|
+
|
|
25
|
+
command line interface for eepyfileserver written in python
|
|
26
|
+
|
|
27
|
+
## prerequisites
|
|
28
|
+
|
|
29
|
+
- python 3.10 (3.12+ required)
|
|
30
|
+
- [`eepyfileserver`](https://codeberg.org/maxeepy/eepyfileserver) 1.1.0-alpha or later
|
|
31
|
+
|
|
32
|
+
## install
|
|
33
|
+
|
|
34
|
+
`pip install efs-cli`
|
|
35
|
+
|
|
36
|
+
## usage
|
|
37
|
+
|
|
38
|
+
### log in to an instance
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
#login fully (lets you upload and download files)
|
|
42
|
+
#password is saved in PLAIN TEXT
|
|
43
|
+
python3 eepyfileserver.py instance "https://example.com" "password123"
|
|
44
|
+
|
|
45
|
+
#login only using the url (lets you download PUBLIC files)
|
|
46
|
+
python3 eepyfileserver.py instance "https://example.com"
|
|
47
|
+
|
|
48
|
+
python3 eepyfileserver.py login ...
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### list files
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python3 eepyfileserver.py list
|
|
55
|
+
python3 eepyfileserver.py ls
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### download a file
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python3 eepyfileserver.py download /example.txt /home/maxeepy/Downloads/example.txt
|
|
62
|
+
python3 eepyfileserver.py get ...
|
|
63
|
+
python3 eepyfileserver.py d ...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### upload a file
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python3 eepyfileserver.py upload /home/maxeepy/Downloads/example.txt /example.txt
|
|
70
|
+
python3 eepyfileserver.py post ...
|
|
71
|
+
python3 eepyfileserver.py up ...
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### delete a file
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python3 eepyfileserver.py delete /example.txt
|
|
78
|
+
python3 eepyfileserver.py remove ...
|
|
79
|
+
python3 eepyfileserver.py rm ...
|
|
80
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/efs_cli/__init__.py
|
|
5
|
+
src/efs_cli/cli.py
|
|
6
|
+
src/efs_cli.egg-info/PKG-INFO
|
|
7
|
+
src/efs_cli.egg-info/SOURCES.txt
|
|
8
|
+
src/efs_cli.egg-info/dependency_links.txt
|
|
9
|
+
src/efs_cli.egg-info/entry_points.txt
|
|
10
|
+
src/efs_cli.egg-info/requires.txt
|
|
11
|
+
src/efs_cli.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
efs_cli
|