efs-cli 1.0.8__tar.gz → 1.0.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: efs-cli
3
- Version: 1.0.8
3
+ Version: 1.0.9
4
4
  Summary: EepyFileServer API CLI written in Python
5
5
  Author: maxie
6
6
  License-Expression: MIT
@@ -0,0 +1,2 @@
1
+ __version__ = "1.0.9"
2
+
@@ -3,6 +3,7 @@ from efs_wrapper import __version__ as wrapper_version
3
3
  from efs_wrapper.v1 import EepyFileServer, EepyFileServerPublic, DiskUsageObject
4
4
  from argparse import ArgumentParser, Namespace
5
5
  import os
6
+ from tempfile import NamedTemporaryFile
6
7
  import json
7
8
  import sys
8
9
 
@@ -15,10 +16,12 @@ def exception_handler(func):
15
16
  try:
16
17
  func(*args, **kwargs)
17
18
  except Exception as exc:
18
- if isinstance(exc.args[1], int):
19
- print(f"Error: {exc.args[0]}")
20
- sys.exit(1)
19
+ if len(exc.args) == 2:
20
+ if isinstance(exc.args[1], int):
21
+ print(f"Error: {exc.args[0]}")
22
+ sys.exit(1)
21
23
  print(f"Error: {exc.__class__.__name__}: {exc}")
24
+ sys.exit(1)
22
25
  return wrapper
23
26
 
24
27
  def get_conf():
@@ -66,7 +69,14 @@ def download(from_path, to_path, public, **__):
66
69
  def read(file_path, **__):
67
70
  api = init_api()
68
71
  file = api.get_file(file_path)
69
- print(file.fetch_file().load().decode("utf-8"))
72
+ _file = file.fetch_file()
73
+ if sys.platform in ["linux", "darwin"]:
74
+ with NamedTemporaryFile() as tmp:
75
+ tmp.write(_file.load())
76
+ tmp.seek(0)
77
+ os.system(f"less {tmp.name}")
78
+ else:
79
+ print(_file.load().decode("utf-8"))
70
80
 
71
81
  @exception_handler
72
82
  def upload(from_path, to_path, **__):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: efs-cli
3
- Version: 1.0.8
3
+ Version: 1.0.9
4
4
  Summary: EepyFileServer API CLI written in Python
5
5
  Author: maxie
6
6
  License-Expression: MIT
@@ -1,2 +0,0 @@
1
- __version__ = "1.0.8"
2
-
File without changes
File without changes
File without changes
File without changes