`blob set` pipe support

This commit is contained in:
Netscape Navigator 2019-09-22 12:34:08 -05:00
parent e3b08f2762
commit 63d3d5463b
2 changed files with 3 additions and 19 deletions

17
TODO.md
View File

@ -9,23 +9,6 @@ pigeon status
# => VERSION: 0.0.1
# => FOO: BAR
pigeon identity new
# => @ajgdylxeifojlxpbmen3exlnsbx8buspsjh37b/ipvi=.ed25519
pigeon identity show
# => @ajgdylxeifojlxpbmen3exlnsbx8buspsjh37b/ipvi=.ed25519
pigeon blob set '"Lol, data"'
# => &2e7a0bc31f3c4fe6114051c3a56c8ed8a030b3b394df7d29d37648e9b8cbf54b.sha256
# Or use echo for big files:
echo "Lol, data"' > pigeon blob set
# => &2e7a0bc31f3c4fe6114051c3a56c8ed8a030b3b394df7d29d37648e9b8cbf54b.sha256
pigeon blob get "&2e7a0bc31f3c4fe6114051c3a56c8ed8a030b3b394df7d29d37648e9b8cbf54b.sha256"
# => "Lol, data"
pigeon message new my_message
# => "Switched to message `my_message`

View File

@ -34,8 +34,9 @@ module Pigeon
class Blob < Thor
desc "set", "Copy arbitrary binary data into the roost"
def set(data)
puts Pigeon::Storage.current.set_blob(data)
def set(data = "")
blob = (data != "") ? data : STDIN.read
puts Pigeon::Storage.current.set_blob(blob)
end
desc "get", "Read arbitrary data from the roost"