bnb-chain / greenfield-cmd

support cmd tool for Greenfield
GNU Lesser General Public License v3.0
27 stars 12 forks source link

feat: support format flag to support json content for the head commands #103

Closed flywukong closed 9 months ago

flywukong commented 9 months ago

Description

1) support --format json flag to return the JSON format of head object/bucket/group 2) fix the logic of uploading the folder by only uploading the last level directory of the file directory structure. For example , if using "object put aaa/bbb/ccc--recursive " to upload folder "ccc" , it will create it should just create "ccc/ " and the sub folders, not "aaa/bbb/ccc/"

Rationale

support json to show the meta

Example

./gnfd-cmd  object head --format json gnfd://diiik1/test8911

latest object info:
{"object_status":"OBJECT_STATUS_SEALED","owner":"0xCEE3823C39Fcc9845D7C7144A836562F37995085","bucket_name":"diiik1","object_name":"download.log90","id":"36290","local_virtual_group_id":1,"payload_size":1110920,"visibility":"VISIBILITY_TYPE_INHERIT","content_type":"text/plain;","create_at":"2023-11-20 16:42:59","checksums":{"checksum[0]":"225c3335355c3333352a5c3232355c3233305c3030375c3030306b635c3236325c3234355c32313357755c323631404c5c333434245c3236345c3335373e5c3234375c5c5c3230365c3333375c3032302e5c3330325c323033305c32373622","checksum[1]":"225c3336355c32333339334a5c3030326d2e3c5c30303644617946775c3233315c3231325c3336345c72625c3234325c3335375c333034697b685c3030305c3231365c323030775c3331327022","checksum[2]":"225c333734465c3335347e5c3335365c3337355c32323129","checksum[3]":"..}}

 ./gnfd-cmd  bucket head  --format json gnfd://diiik1
latest bucket info:
{"owner":"0xCEE3823C39Fcc9845D7C7144A836562F37995085","bucket_name":"dskj1909","visibility":"VISIBILITY_TYPE_PRIVATE","id":"2189","create_at":"1700725826","payment_address":"0xCEE3823C39Fcc9845D7C7144A836562F37995085","global_virtual_group_family_id":11,"bucket_status":"BUCKET_STATUS_CREATED"}

./gnfd-cmd  group head --format json leo-group
latest group info:
{"owner":"\"0xCEE3823C39Fcc9845D7C7144A836562F37995085\"","group_name":"\"leo-group\"","id":"\"180\""}

Changes

Notable changes: