NGPIris 5.2.3.dev1__tar.gz → 5.2.3.dev2__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.
Files changed (130) hide show
  1. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/cli/__init__.py +87 -40
  2. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris.egg-info/PKG-INFO +1 -1
  3. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/PKG-INFO +1 -1
  4. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/pyproject.toml +1 -1
  5. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/LICENSE +0 -0
  6. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/MANIFEST.in +0 -0
  7. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/__init__.py +0 -0
  8. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hci/__init__.py +0 -0
  9. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hci/exceptions.py +0 -0
  10. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hci/hci.py +0 -0
  11. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hci/helpers.py +0 -0
  12. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hcp/__init__.py +0 -0
  13. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hcp/exceptions.py +0 -0
  14. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hcp/hcp.py +0 -0
  15. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hcp/helpers.py +0 -0
  16. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/hcp/statistics.py +0 -0
  17. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/parse_credentials/__init__.py +0 -0
  18. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/parse_credentials/parse_credentials.py +0 -0
  19. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/utils/__init__.py +0 -0
  20. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris/utils/utils.py +0 -0
  21. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris.egg-info/SOURCES.txt +0 -0
  22. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris.egg-info/dependency_links.txt +0 -0
  23. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris.egg-info/entry_points.txt +0 -0
  24. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris.egg-info/requires.txt +0 -0
  25. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/NGPIris.egg-info/top_level.txt +0 -0
  26. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/README.md +0 -0
  27. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/IRIS_5_changelog.md +0 -0
  28. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/Makefile +0 -0
  29. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/NGPIris.cli.rst +0 -0
  30. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/NGPIris.hci.rst +0 -0
  31. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/NGPIris.hcp.rst +0 -0
  32. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/NGPIris.parse_credentials.rst +0 -0
  33. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/NGPIris.rst +0 -0
  34. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/NGPIris.utils.rst +0 -0
  35. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/Tutorial.md +0 -0
  36. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/.DS_Store +0 -0
  37. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/IRIS_5_changelog.doctree +0 -0
  38. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/NGPIris.cli.doctree +0 -0
  39. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/NGPIris.doctree +0 -0
  40. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/NGPIris.hci.doctree +0 -0
  41. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/NGPIris.hcp.doctree +0 -0
  42. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/NGPIris.parse_credentials.doctree +0 -0
  43. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/NGPIris.utils.doctree +0 -0
  44. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/README.doctree +0 -0
  45. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/Tutorial.doctree +0 -0
  46. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/environment.pickle +0 -0
  47. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/index.doctree +0 -0
  48. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/doctrees/modules.doctree +0 -0
  49. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/.buildinfo +0 -0
  50. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/IRIS_5_changelog.html +0 -0
  51. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/NGPIris.cli.html +0 -0
  52. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/NGPIris.hci.html +0 -0
  53. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/NGPIris.hcp.html +0 -0
  54. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/NGPIris.html +0 -0
  55. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/NGPIris.parse_credentials.html +0 -0
  56. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/NGPIris.utils.html +0 -0
  57. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/README.html +0 -0
  58. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/Tutorial.html +0 -0
  59. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_downloads/ee00c4f6f22dc2671c766f728f00006f/credentials_template.json +0 -0
  60. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/cli.html +0 -0
  61. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/hci/exceptions.html +0 -0
  62. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/hci/hci.html +0 -0
  63. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/hci/helpers.html +0 -0
  64. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/hcp/exceptions.html +0 -0
  65. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/hcp/hcp.html +0 -0
  66. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/hcp/helpers.html +0 -0
  67. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/hcp/statistics.html +0 -0
  68. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/parse_credentials/parse_credentials.html +0 -0
  69. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/NGPIris/utils/utils.html +0 -0
  70. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_modules/index.html +0 -0
  71. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/IRIS_5_changelog.md.txt +0 -0
  72. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/NGPIris.cli.rst.txt +0 -0
  73. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/NGPIris.hci.rst.txt +0 -0
  74. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/NGPIris.hcp.rst.txt +0 -0
  75. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/NGPIris.parse_credentials.rst.txt +0 -0
  76. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/NGPIris.rst.txt +0 -0
  77. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/NGPIris.utils.rst.txt +0 -0
  78. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/README.md.txt +0 -0
  79. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/Tutorial.md.txt +0 -0
  80. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/index.rst.txt +0 -0
  81. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_sources/modules.rst.txt +0 -0
  82. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/alabaster.css +0 -0
  83. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/basic.css +0 -0
  84. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/custom.css +0 -0
  85. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/debug.css +0 -0
  86. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/doctools.js +0 -0
  87. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/documentation_options.js +0 -0
  88. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/file.png +0 -0
  89. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/language_data.js +0 -0
  90. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/minus.png +0 -0
  91. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/plus.png +0 -0
  92. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/pygments.css +0 -0
  93. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/scripts/furo-extensions.js +0 -0
  94. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/scripts/furo.js +0 -0
  95. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/scripts/furo.js.LICENSE.txt +0 -0
  96. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/scripts/furo.js.map +0 -0
  97. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/searchtools.js +0 -0
  98. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/skeleton.css +0 -0
  99. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/sphinx_highlight.js +0 -0
  100. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/styles/furo-extensions.css +0 -0
  101. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/styles/furo-extensions.css.map +0 -0
  102. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/styles/furo.css +0 -0
  103. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/_static/styles/furo.css.map +0 -0
  104. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/genindex.html +0 -0
  105. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/index.html +0 -0
  106. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/modules.html +0 -0
  107. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/objects.inv +0 -0
  108. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/py-modindex.html +0 -0
  109. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/search.html +0 -0
  110. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/_build/html/searchindex.js +0 -0
  111. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/conf.py +0 -0
  112. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/index.rst +0 -0
  113. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/make.bat +0 -0
  114. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/docs/modules.rst +0 -0
  115. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/setup.cfg +0 -0
  116. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/.DS_Store +0 -0
  117. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/80MB_test_file +0 -0
  118. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/a folder of data/80MB_test_file_0 +0 -0
  119. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/a folder of data/80MB_test_file_1 +0 -0
  120. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/complete_creds_0.json +0 -0
  121. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/complete_creds_1.json +0 -0
  122. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/complete_creds_2.json +0 -0
  123. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/incomplete_creds_0.json +0 -0
  124. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/incomplete_creds_1.json +0 -0
  125. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/incomplete_creds_2.json +0 -0
  126. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/incomplete_creds_3.json +0 -0
  127. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/data/incomplete_creds_4.json +0 -0
  128. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/test_hci.py +0 -0
  129. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/test_hcp.py +0 -0
  130. {ngpiris-5.2.3.dev1 → ngpiris-5.2.3.dev2}/tests/test_parse_credentials.py +0 -0
@@ -90,8 +90,14 @@ def cli(context : Context, credentials : str, debug : bool):
90
90
  @click.argument("bucket")
91
91
  @click.argument("source")
92
92
  @click.argument("destination")
93
+ @click.option(
94
+ "-dr",
95
+ "--dry_run",
96
+ help = "Simulate the command execution without making actual changes. Useful for testing and verification",
97
+ is_flag = True
98
+ )
93
99
  @click.pass_context
94
- def upload(context : Context, bucket : str, source : str, destination : str):
100
+ def upload(context : Context, bucket : str, source : str, destination : str, dry_run : bool):
95
101
  """
96
102
  Upload files to an HCP bucket/namespace.
97
103
 
@@ -106,11 +112,17 @@ def upload(context : Context, bucket : str, source : str, destination : str):
106
112
  destination = add_trailing_slash(destination)
107
113
  if Path(source).is_dir():
108
114
  source = add_trailing_slash(source)
109
- hcph.upload_folder(source, destination)
115
+ if dry_run:
116
+ click.echo("This command would have uploaded the folder \"" + source + "\" to \"" + destination + "\"")
117
+ else:
118
+ hcph.upload_folder(source, destination)
110
119
  else:
111
120
  file_name = Path(source).name
112
121
  destination += file_name
113
- hcph.upload_file(source, destination)
122
+ if dry_run:
123
+ click.echo("This command would have uploaded the file \"" + source + "\" to \"" + destination + "\"")
124
+ else:
125
+ hcph.upload_file(source, destination)
114
126
 
115
127
  @cli.command()
116
128
  @click.argument("bucket")
@@ -128,8 +140,14 @@ def upload(context : Context, bucket : str, source : str, destination : str):
128
140
  help = "Ignore the download limit",
129
141
  is_flag = True
130
142
  )
143
+ @click.option(
144
+ "-dr",
145
+ "--dry_run",
146
+ help = "Simulate the command execution without making actual changes. Useful for testing and verification",
147
+ is_flag = True
148
+ )
131
149
  @click.pass_context
132
- def download(context : Context, bucket : str, source : str, destination : str, force : bool, ignore_warning : bool):
150
+ def download(context : Context, bucket : str, source : str, destination : str, force : bool, ignore_warning : bool, dry_run : bool):
133
151
  """
134
152
  Download a file or folder from an HCP bucket/namespace.
135
153
 
@@ -143,45 +161,58 @@ def download(context : Context, bucket : str, source : str, destination : str, f
143
161
  hcph.mount_bucket(bucket)
144
162
  if not Path(destination).exists():
145
163
  Path(destination).mkdir()
146
-
147
- if object_is_folder(source, hcph):
148
- if source == "/":
149
- source = ""
150
-
151
- cumulative_download_size = Byte(0)
152
- if not ignore_warning:
153
- click.echo("Computing download size...")
154
- for object in hcph.list_objects(source):
155
- object : dict
156
- cumulative_download_size += Byte(object["Size"])
157
- if cumulative_download_size >= TiB(1):
158
- click.echo("WARNING: You are about to download more than 1 TB of data. Is this your intention? [y/N]: ", nl = False)
159
- inp = click.getchar(True)
160
- if inp == "y" or inp == "Y":
161
- break
162
- else: # inp == "n" or inp == "N" or something else
163
- exit("\nAborting download")
164
-
165
- hcph.download_folder(source, Path(destination).as_posix())
164
+
165
+ if not dry_run:
166
+ if object_is_folder(source, hcph):
167
+ if source == "/":
168
+ source = ""
169
+
170
+ cumulative_download_size = Byte(0)
171
+ if not ignore_warning:
172
+ click.echo("Computing download size...")
173
+ for object in hcph.list_objects(source):
174
+ object : dict
175
+ cumulative_download_size += Byte(object["Size"])
176
+ if cumulative_download_size >= TiB(1):
177
+ click.echo("WARNING: You are about to download more than 1 TB of data. Is this your intention? [y/N]: ", nl = False)
178
+ inp = click.getchar(True)
179
+ if inp == "y" or inp == "Y":
180
+ break
181
+ else: # inp == "n" or inp == "N" or something else
182
+ exit("\nAborting download")
183
+
184
+ hcph.download_folder(source, Path(destination).as_posix())
185
+ else:
186
+ if Byte(hcph.get_object(source)["ContentLength"]) >= TiB(1):
187
+ click.echo("WARNING: You are about to download more than 1 TB of data. Is this your intention? [y/N]: ", nl = False)
188
+ inp = click.getchar(True)
189
+ if inp == "y" or inp == "Y":
190
+ pass
191
+ else: # inp == "n" or inp == "N" or something else
192
+ exit("\nAborting download")
193
+
194
+ downloaded_source = Path(destination) / Path(source).name
195
+ if downloaded_source.exists() and not force:
196
+ exit("Object already exists. If you wish to overwrite the existing file, use the -f, --force option")
197
+ hcph.download_file(source, downloaded_source.as_posix())
166
198
  else:
167
- if Byte(hcph.get_object(source)["ContentLength"]) >= TiB(1):
168
- click.echo("WARNING: You are about to download more than 1 TB of data. Is this your intention? [y/N]: ", nl = False)
169
- inp = click.getchar(True)
170
- if inp == "y" or inp == "Y":
171
- pass
172
- else: # inp == "n" or inp == "N" or something else
173
- exit("\nAborting download")
174
-
175
- downloaded_source = Path(destination) / Path(source).name
176
- if downloaded_source.exists() and not force:
177
- exit("Object already exists. If you wish to overwrite the existing file, use the -f, --force option")
178
- hcph.download_file(source, downloaded_source.as_posix())
199
+ if object_is_folder(source, hcph):
200
+ click.echo("This command would have downloaded the folder \"" + source + "\". If you wish to know the contents of this folder, use the 'list-objects' command")
201
+ else:
202
+ click.echo("This command would have downloaded the object \"" + source + "\":")
203
+ click.echo(list(hcph.list_objects(source))[0])
179
204
 
180
205
  @cli.command()
181
206
  @click.argument("bucket")
182
207
  @click.argument("object")
208
+ @click.option(
209
+ "-dr",
210
+ "--dry_run",
211
+ help = "Simulate the command execution without making actual changes. Useful for testing and verification",
212
+ is_flag = True
213
+ )
183
214
  @click.pass_context
184
- def delete_object(context : Context, bucket : str, object : str):
215
+ def delete_object(context : Context, bucket : str, object : str, dry_run : bool):
185
216
  """
186
217
  Delete an object from an HCP bucket/namespace.
187
218
 
@@ -191,13 +222,24 @@ def delete_object(context : Context, bucket : str, object : str):
191
222
  """
192
223
  hcph : HCPHandler = get_HCPHandler(context)
193
224
  hcph.mount_bucket(bucket)
194
- hcph.delete_object(object)
225
+ if not dry_run:
226
+ hcph.delete_object(object)
227
+ else:
228
+ click.echo("This command would delete:")
229
+ click.echo(list(hcph.list_objects(object))[0])
230
+
195
231
 
196
232
  @cli.command()
197
233
  @click.argument("bucket")
198
234
  @click.argument("folder")
235
+ @click.option(
236
+ "-dr",
237
+ "--dry_run",
238
+ help = "Simulate the command execution without making actual changes. Useful for testing and verification",
239
+ is_flag = True
240
+ )
199
241
  @click.pass_context
200
- def delete_folder(context : Context, bucket : str, folder : str):
242
+ def delete_folder(context : Context, bucket : str, folder : str, dry_run : bool):
201
243
  """
202
244
  Delete a folder from an HCP bucket/namespace.
203
245
 
@@ -207,7 +249,12 @@ def delete_folder(context : Context, bucket : str, folder : str):
207
249
  """
208
250
  hcph : HCPHandler = get_HCPHandler(context)
209
251
  hcph.mount_bucket(bucket)
210
- hcph.delete_folder(folder)
252
+ if not dry_run:
253
+ hcph.delete_folder(folder)
254
+ else:
255
+ click.echo("By deleting \"" + folder + "\", the following objects would have been deleted (not including objects in sub-folders):")
256
+ for obj in hcph.list_objects(folder):
257
+ click.echo(obj)
211
258
 
212
259
  @cli.command()
213
260
  @click.pass_context
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: NGPIris
3
- Version: 5.2.3.dev1
3
+ Version: 5.2.3.dev2
4
4
  Author-email: Erik Brink <erik.brink@gu.se>, Isak Sylvin <isak.sylvin@gu.se>
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: NGPIris
3
- Version: 5.2.3.dev1
3
+ Version: 5.2.3.dev2
4
4
  Author-email: Erik Brink <erik.brink@gu.se>, Isak Sylvin <isak.sylvin@gu.se>
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "NGPIris"
3
- version = "5.2.3.dev1"
3
+ version = "5.2.3.dev2"
4
4
  readme = "README.md"
5
5
  dependencies = [
6
6
  "requests >= 2.31.0",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes