filedepot 0.3.2 → 0.3.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10f4eb8c2f02815889342a7ad7f92d759d419168f56887590c4f19bc286ed21c
4
- data.tar.gz: b3b2c5a9b4c3761ed7cad87ba41af45f9084a44f9a25d922145736cf868540c5
3
+ metadata.gz: bf5f922d9c2b8bca9118b5d8196b493d36673a6d6337da6e98364bc4dfa21a5f
4
+ data.tar.gz: a4526f505fcd997e9f61c156ed45c91a99d62988abbef74a1fe2f9d346c6a0b7
5
5
  SHA512:
6
- metadata.gz: 8ab762be47f8bbc307c3fde15617c09e79a96bf19dac274da77f94432d4c87c6fe00129887f7c2f34f5ecb21fbcc220924a0fdf5448c6de681738d7240df0682
7
- data.tar.gz: b778a9812396cd27cdbf9b9bfcaa1b0fc7630aa45831b85f9d4d6f1d670fdb9e47b3622931d60ee9c49436c554f4b02d2e95ee58ffd66926cdb7a22cd7a5ff93
6
+ metadata.gz: 5fb46cb1c15d586a7a2aea7a63b2858f56c93a82ff745b3a1765584d1f65a129bbf52398280256e41f7d76fa5ce4bdef3fc031bdfeed28f82a8483c12996c3c9
7
+ data.tar.gz: 8d6b2287c0aab4792f36b9412323cd910348781d216c1c2adb0b647fb82738353a2f8dc9d983b6c5d0719d9c47303a1103c8b62b4b0cf0a338ec33605263ecc5
data/README.md CHANGED
@@ -61,7 +61,7 @@ When `default_store` does not match any store name, the first store is used.
61
61
  | `filedepot handles` | List all handles in storage |
62
62
  | `filedepot versions HANDLE` | List all versions of a handle |
63
63
  | `filedepot info HANDLE` | Show info for a handle |
64
- | `filedepot delete HANDLE [VERSION] [--yes]` | Delete file(s) after confirmation; use `--yes` to skip confirmation |
64
+ | `filedepot delete HANDLE [--version N] [--yes]` | Delete file(s) after confirmation; use `--version N` for a specific version, `--yes` to skip confirmation |
65
65
  | `filedepot test` | Run end-to-end test (push, pull, delete a temporary file) |
66
66
 
67
67
  ### Setup
@@ -101,7 +101,7 @@ Shows handle, remote base path, current version, updated-at datetime, and latest
101
101
 
102
102
  ### Delete
103
103
 
104
- Deletes all versions of a handle, or a specific version if `VERSION` is given. Requires typing the handle name to confirm. Use `--yes` or `-y` to skip confirmation (for scripts).
104
+ Deletes all versions of a handle, or a specific version with `--version N`. Requires typing the handle name to confirm. Use `--yes` or `-y` to skip confirmation (for scripts).
105
105
 
106
106
  ### Test
107
107
 
data/lib/filedepot/cli.rb CHANGED
@@ -41,8 +41,8 @@ module Filedepot
41
41
  filedepot pull test --version 2
42
42
  filedepot pull test --version 2 --path ./test/file.txt
43
43
  HELP
44
- versions: "Usage: filedepot versions HANDLE\n\nList all versions of a handle. Each version has an integer ID from 1 to n.",
45
- delete: "Usage: filedepot delete HANDLE [VERSION]\n\nAfter confirmation, deletes all versions of a file.\nIf VERSION is specified, deletes only that specific version.",
44
+ versions: "Usage: filedepot versions HANDLE\n\nList all versions of a handle. Each version has an integer ID from 1 to n.\nTo get the list of handles, use: filedepot handles",
45
+ delete: "Usage: filedepot delete HANDLE [--version N]\n\nAfter confirmation, deletes all versions of a file.\nIf --version N is specified, deletes only that specific version.",
46
46
  info: "Usage: filedepot info HANDLE\n\nShow info for a handle: remote base path and current version.",
47
47
  handles: "Usage: filedepot handles\n\nList all handles in storage.",
48
48
  test: "Usage: filedepot test\n\nRun end-to-end test: push, pull, delete a temporary file."
@@ -285,9 +285,10 @@ module Filedepot
285
285
  end
286
286
  end
287
287
 
288
- desc "delete HANDLE [VERSION]", "After confirmation, delete all versions of a file; or only a specific version if specified"
288
+ desc "delete HANDLE", "After confirmation, delete all versions of a file; or only a specific version with --version N"
289
+ method_option :version, type: :string, desc: "Delete only this version number"
289
290
  method_option :yes, type: :boolean, aliases: "-y", desc: "Skip confirmation (for scripts)"
290
- def delete(handle = nil, version = nil)
291
+ def delete(handle = nil)
291
292
  if handle.nil?
292
293
  puts COMMAND_HELP[:delete]
293
294
  return
@@ -302,9 +303,10 @@ module Filedepot
302
303
  puts "Error: Handle '#{handle}' not found."
303
304
  return
304
305
  end
305
- if version
306
+ version = (options[:version].nil? || options[:version].empty?) ? nil : options[:version].to_i
307
+ if version && version > 0
306
308
  version_nums = versions_list.map(&:first)
307
- unless version_nums.include?(version.to_i)
309
+ unless version_nums.include?(version)
308
310
  puts "Error: Version #{version} not found for handle '#{handle}'."
309
311
  return
310
312
  end
@@ -344,27 +346,22 @@ module Filedepot
344
346
  end
345
347
 
346
348
  store = Config.current_store
347
- default_name = config["default_store"]
348
-
349
- puts "filedepot"
350
- puts "--------"
351
- puts "Current store: #{default_name}"
352
349
  if store
350
+ puts "Current store:"
353
351
  type_str = store["type"] ? store["type"] : "unknown"
354
- puts " Type: #{type_str} (#{store['host']})"
355
- puts " Base path: #{store['base_path']}"
352
+ puts "#{store.to_yaml}"
356
353
  end
357
354
  puts ""
358
355
  puts "Available commands:"
359
- puts " filedepot setup Create or reconfigure config"
360
- puts " filedepot config Open config file using $EDITOR"
361
- puts " filedepot test Run end-to-end test"
362
- puts " filedepot info HANDLE Show info for a handle"
363
- puts " filedepot handles List all handles in storage"
364
- puts " filedepot versions HANDLE List all versions of a handle"
365
- puts " filedepot push HANDLE FILE Send file to current storage"
366
- puts " filedepot pull HANDLE [--path PATH] [--version N] Get file from storage"
367
- puts " filedepot delete HANDLE [VER] Delete file(s) after confirmation"
356
+ puts "filedepot setup Create or reconfigure config"
357
+ puts "filedepot config Open config file using $EDITOR"
358
+ puts "filedepot test Run end-to-end test"
359
+ puts "filedepot info HANDLE Show info for a handle"
360
+ puts "filedepot handles List all handles in storage"
361
+ puts "filedepot versions HANDLE List all versions of a handle"
362
+ puts "filedepot push HANDLE FILE Send file to current storage"
363
+ puts "filedepot pull HANDLE [--path PATH] [--version N] Get file from storage"
364
+ puts "filedepot delete HANDLE [--version N] Delete file(s) after confirmation"
368
365
  puts ""
369
366
  puts "Use 'filedepot help COMMAND' for more information on a command."
370
367
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Filedepot
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filedepot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filedepot