efs-cli 1.0.6__tar.gz → 1.0.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.
- {efs_cli-1.0.6 → efs_cli-1.0.7}/PKG-INFO +2 -2
- {efs_cli-1.0.6 → efs_cli-1.0.7}/pyproject.toml +2 -2
- efs_cli-1.0.7/src/efs_cli/__init__.py +2 -0
- {efs_cli-1.0.6 → efs_cli-1.0.7}/src/efs_cli/cli.py +42 -5
- {efs_cli-1.0.6 → efs_cli-1.0.7}/src/efs_cli.egg-info/PKG-INFO +2 -2
- efs_cli-1.0.7/src/efs_cli.egg-info/requires.txt +2 -0
- efs_cli-1.0.6/src/efs_cli/__init__.py +0 -2
- efs_cli-1.0.6/src/efs_cli.egg-info/requires.txt +0 -2
- {efs_cli-1.0.6 → efs_cli-1.0.7}/LICENSE +0 -0
- {efs_cli-1.0.6 → efs_cli-1.0.7}/README.md +0 -0
- {efs_cli-1.0.6 → efs_cli-1.0.7}/setup.cfg +0 -0
- {efs_cli-1.0.6 → efs_cli-1.0.7}/src/efs_cli.egg-info/SOURCES.txt +0 -0
- {efs_cli-1.0.6 → efs_cli-1.0.7}/src/efs_cli.egg-info/dependency_links.txt +0 -0
- {efs_cli-1.0.6 → efs_cli-1.0.7}/src/efs_cli.egg-info/entry_points.txt +0 -0
- {efs_cli-1.0.6 → efs_cli-1.0.7}/src/efs_cli.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: efs-cli
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: EepyFileServer API CLI written in Python
|
|
5
5
|
Author: maxie
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,7 +17,7 @@ Requires-Python: >=3.10
|
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: requests>=2.30
|
|
20
|
-
Requires-Dist: efs-wrapper>=1.0.
|
|
20
|
+
Requires-Dist: efs-wrapper>=1.0.5
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
23
|
# efs-cli (formerly eepyfileserver-cli)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools >= 77.0.3", "requests >= 2.30", "efs-wrapper >= 1.0.
|
|
2
|
+
requires = ["setuptools >= 77.0.3", "requests >= 2.30", "efs-wrapper >= 1.0.5"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
@@ -12,7 +12,7 @@ readme = "README.md"
|
|
|
12
12
|
requires-python = ">=3.10"
|
|
13
13
|
dependencies = [
|
|
14
14
|
"requests >= 2.30",
|
|
15
|
-
"efs-wrapper >= 1.0.
|
|
15
|
+
"efs-wrapper >= 1.0.5"
|
|
16
16
|
]
|
|
17
17
|
classifiers = [
|
|
18
18
|
"Programming Language :: Python :: 3",
|
|
@@ -37,8 +37,12 @@ def auth(base_url, password, **__):
|
|
|
37
37
|
json.dump(data, file)
|
|
38
38
|
print("Saved eepyfileserver password and base url in config.json")
|
|
39
39
|
|
|
40
|
-
def download(from_path, to_path, **__):
|
|
40
|
+
def download(from_path, to_path, public, **__):
|
|
41
41
|
api = init_api()
|
|
42
|
+
if public and not isinstance(api, EepyFileServerPublic):
|
|
43
|
+
api = api.public
|
|
44
|
+
if from_path.startswith("/public"):
|
|
45
|
+
from_path = from_path.removeprefix("/public")
|
|
42
46
|
file = api.get_file(from_path)
|
|
43
47
|
file.fetch_file().save(to_path)
|
|
44
48
|
print(f"Downloaded {from_path} to {to_path}")
|
|
@@ -92,7 +96,7 @@ def instance(**__):
|
|
|
92
96
|
|
|
93
97
|
def url_for(file_path, public, check_if_exists, **__):
|
|
94
98
|
api = init_api()
|
|
95
|
-
if public:
|
|
99
|
+
if public and not isinstance(api, EepyFileServerPublic):
|
|
96
100
|
api = api.public
|
|
97
101
|
if file_path.startswith("/public"):
|
|
98
102
|
file_path = file_path.removeprefix("/public")
|
|
@@ -102,8 +106,30 @@ def url_for(file_path, public, check_if_exists, **__):
|
|
|
102
106
|
print(e.args[0])
|
|
103
107
|
sys.exit(1)
|
|
104
108
|
|
|
105
|
-
def
|
|
106
|
-
|
|
109
|
+
def overwrite(from_path, to_path, **__):
|
|
110
|
+
api = init_api()
|
|
111
|
+
if hasattr(api, "overwrite_file"):
|
|
112
|
+
with open(from_path, "rb") as file:
|
|
113
|
+
api.overwrite_file(to_path, file)
|
|
114
|
+
print(f"{to_path} overwritten")
|
|
115
|
+
else:
|
|
116
|
+
print("Login using 'efs-cli auth <base url> <password>' to delete files")
|
|
117
|
+
sys.exit(1)
|
|
118
|
+
|
|
119
|
+
def metadata(path, public, **__):
|
|
120
|
+
api = init_api()
|
|
121
|
+
if public and not isinstance(api, EepyFileServerPublic):
|
|
122
|
+
api = api.public
|
|
123
|
+
if path.startswith("/public"):
|
|
124
|
+
path = path.removeprefix("/public")
|
|
125
|
+
if api.is_file(path):
|
|
126
|
+
print(api.get_file(path).metadata.to_dict())
|
|
127
|
+
return
|
|
128
|
+
if api.is_directory(path):
|
|
129
|
+
print(api.get_tree(path))
|
|
130
|
+
return
|
|
131
|
+
print(f"{path} does not exist or is not a file or a directory")
|
|
132
|
+
sys.exit(1)
|
|
107
133
|
|
|
108
134
|
def main():
|
|
109
135
|
parser = ArgumentParser("efs-cli", description="eepyfileserver cli tool for downloading and uploading files")
|
|
@@ -117,6 +143,7 @@ def main():
|
|
|
117
143
|
download_parser = subparser.add_parser("download", help="download a file", aliases=["get", "d"])
|
|
118
144
|
download_parser.add_argument("from_path", help="the efs path of the file to download")
|
|
119
145
|
download_parser.add_argument("to_path", help="the local path to download the file to")
|
|
146
|
+
download_parser.add_argument("-p", "--public", action="store_true", help="use a public url if set")
|
|
120
147
|
download_parser.set_defaults(func=download)
|
|
121
148
|
|
|
122
149
|
read_parser = subparser.add_parser("read", help="read a file", aliases=["cat"])
|
|
@@ -128,6 +155,16 @@ def main():
|
|
|
128
155
|
upload_parser.add_argument("to_path", help="the efs path to upload the file to")
|
|
129
156
|
upload_parser.set_defaults(func=upload)
|
|
130
157
|
|
|
158
|
+
overwrite_parser = subparser.add_parser("overwrite", help="overwrite a file", aliases=["over"])
|
|
159
|
+
overwrite_parser.add_argument("from_path", help="the local path of the file to use")
|
|
160
|
+
overwrite_parser.add_argument("to_path", help="the efs file path to overwrite")
|
|
161
|
+
overwrite_parser.set_defaults(func=overwrite)
|
|
162
|
+
|
|
163
|
+
metadata_parser = subparser.add_parser("metadata", help="get metadata for a file or a directory", aliases=["meta"])
|
|
164
|
+
metadata_parser.add_argument("path", help="the efs path of the file to get metadata for")
|
|
165
|
+
metadata_parser.add_argument("-p", "--public", action="store_true", help="use a public url if set")
|
|
166
|
+
metadata_parser.set_defaults(func=metadata)
|
|
167
|
+
|
|
131
168
|
list_files_parser = subparser.add_parser("list", help="list current files on efs", aliases=["ls", "files"])
|
|
132
169
|
list_files_parser.set_defaults(func=list_files)
|
|
133
170
|
|
|
@@ -143,7 +180,7 @@ def main():
|
|
|
143
180
|
|
|
144
181
|
urlfor_parser = subparser.add_parser("url-for", help="get the url for a file", aliases=["url"])
|
|
145
182
|
urlfor_parser.add_argument("file_path", help="the efs file path to return url for")
|
|
146
|
-
urlfor_parser.add_argument("-p", "--public", action="store_true", help="return public url if set
|
|
183
|
+
urlfor_parser.add_argument("-p", "--public", action="store_true", help="return public url if set")
|
|
147
184
|
urlfor_parser.add_argument("-c", "--check-if-exists", action="store_true", help="check if the file exists before returning the url")
|
|
148
185
|
urlfor_parser.set_defaults(func=url_for)
|
|
149
186
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: efs-cli
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: EepyFileServer API CLI written in Python
|
|
5
5
|
Author: maxie
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,7 +17,7 @@ Requires-Python: >=3.10
|
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: requests>=2.30
|
|
20
|
-
Requires-Dist: efs-wrapper>=1.0.
|
|
20
|
+
Requires-Dist: efs-wrapper>=1.0.5
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
23
|
# efs-cli (formerly eepyfileserver-cli)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|