efs-cli 1.0.5__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.5 → efs_cli-1.0.7}/PKG-INFO +2 -2
- {efs_cli-1.0.5 → 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.5 → efs_cli-1.0.7}/src/efs_cli/cli.py +62 -4
- {efs_cli-1.0.5 → 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.5/src/efs_cli/__init__.py +0 -2
- efs_cli-1.0.5/src/efs_cli.egg-info/requires.txt +0 -2
- {efs_cli-1.0.5 → efs_cli-1.0.7}/LICENSE +0 -0
- {efs_cli-1.0.5 → efs_cli-1.0.7}/README.md +0 -0
- {efs_cli-1.0.5 → efs_cli-1.0.7}/setup.cfg +0 -0
- {efs_cli-1.0.5 → efs_cli-1.0.7}/src/efs_cli.egg-info/SOURCES.txt +0 -0
- {efs_cli-1.0.5 → efs_cli-1.0.7}/src/efs_cli.egg-info/dependency_links.txt +0 -0
- {efs_cli-1.0.5 → efs_cli-1.0.7}/src/efs_cli.egg-info/entry_points.txt +0 -0
- {efs_cli-1.0.5 → 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}")
|
|
@@ -69,7 +73,7 @@ def remove(file_path, **__):
|
|
|
69
73
|
print(f"Deleted {file_path}")
|
|
70
74
|
else:
|
|
71
75
|
print("Login using 'efs-cli auth <base url> <password>' to delete files")
|
|
72
|
-
|
|
76
|
+
sys.exit(1)
|
|
73
77
|
|
|
74
78
|
def ver(**__):
|
|
75
79
|
conf = get_conf()
|
|
@@ -90,6 +94,43 @@ def instance(**__):
|
|
|
90
94
|
print(f" Used : {disk_usage.human.used} Megabytes")
|
|
91
95
|
print(f" Free : {disk_usage.human.free} Megabytes")
|
|
92
96
|
|
|
97
|
+
def url_for(file_path, public, check_if_exists, **__):
|
|
98
|
+
api = init_api()
|
|
99
|
+
if public and not isinstance(api, EepyFileServerPublic):
|
|
100
|
+
api = api.public
|
|
101
|
+
if file_path.startswith("/public"):
|
|
102
|
+
file_path = file_path.removeprefix("/public")
|
|
103
|
+
try:
|
|
104
|
+
print(api.url_to_file(file_path, check_if_exists = check_if_exists))
|
|
105
|
+
except Exception as e:
|
|
106
|
+
print(e.args[0])
|
|
107
|
+
sys.exit(1)
|
|
108
|
+
|
|
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)
|
|
133
|
+
|
|
93
134
|
def main():
|
|
94
135
|
parser = ArgumentParser("efs-cli", description="eepyfileserver cli tool for downloading and uploading files")
|
|
95
136
|
subparser = parser.add_subparsers()
|
|
@@ -102,6 +143,7 @@ def main():
|
|
|
102
143
|
download_parser = subparser.add_parser("download", help="download a file", aliases=["get", "d"])
|
|
103
144
|
download_parser.add_argument("from_path", help="the efs path of the file to download")
|
|
104
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")
|
|
105
147
|
download_parser.set_defaults(func=download)
|
|
106
148
|
|
|
107
149
|
read_parser = subparser.add_parser("read", help="read a file", aliases=["cat"])
|
|
@@ -111,13 +153,23 @@ def main():
|
|
|
111
153
|
upload_parser = subparser.add_parser("upload", help="upload a file", aliases=["post", "up", "put"])
|
|
112
154
|
upload_parser.add_argument("from_path", help="the local path of the file to upload")
|
|
113
155
|
upload_parser.add_argument("to_path", help="the efs path to upload the file to")
|
|
114
|
-
upload_parser.set_defaults(func=upload)
|
|
156
|
+
upload_parser.set_defaults(func=upload)
|
|
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)
|
|
115
167
|
|
|
116
168
|
list_files_parser = subparser.add_parser("list", help="list current files on efs", aliases=["ls", "files"])
|
|
117
169
|
list_files_parser.set_defaults(func=list_files)
|
|
118
170
|
|
|
119
171
|
remove_parser = subparser.add_parser("delete", help="delete a file", aliases=["remove", "rm"])
|
|
120
|
-
remove_parser.add_argument("file_path")
|
|
172
|
+
remove_parser.add_argument("file_path", help="the efs file path to delete")
|
|
121
173
|
remove_parser.set_defaults(func=remove)
|
|
122
174
|
|
|
123
175
|
version_parser = subparser.add_parser("version", help="view efs-cli and dependencies versions", aliases=["ver"])
|
|
@@ -126,6 +178,12 @@ def main():
|
|
|
126
178
|
instance_parser = subparser.add_parser("instance", help="view eepyfileserver instance info", aliases=["info"])
|
|
127
179
|
instance_parser.set_defaults(func=instance)
|
|
128
180
|
|
|
181
|
+
urlfor_parser = subparser.add_parser("url-for", help="get the url for a file", aliases=["url"])
|
|
182
|
+
urlfor_parser.add_argument("file_path", help="the efs file path to return url for")
|
|
183
|
+
urlfor_parser.add_argument("-p", "--public", action="store_true", help="return public url if set")
|
|
184
|
+
urlfor_parser.add_argument("-c", "--check-if-exists", action="store_true", help="check if the file exists before returning the url")
|
|
185
|
+
urlfor_parser.set_defaults(func=url_for)
|
|
186
|
+
|
|
129
187
|
args = parser.parse_args()
|
|
130
188
|
if args == Namespace():
|
|
131
189
|
args = parser.parse_args(["-h"])
|
|
@@ -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
|