cli icon indicating copy to clipboard operation
cli copied to clipboard

--only/--quiet/… option for hyp create

Open Treora opened this issue 4 years ago • 4 comments

For use in shell scripts or to pipe hyp’s output into other commands, it would be practical to have an option to only get the address of the created drive/bee from hyp create. Example output, currently:

> hyp create drive
Drive Created: hyper://87f05a94b1916674fb00d4cf4da0ed3ae9d9491ebd706afbb01e2a83332f4a4e
Seeding hyperdrive

The line containing the address appears to be output via stderr, not stdout, so currently some juggling like this is required to read only the hyper://… address:

hyp create drive 2>&1 | grep -oE "hyper://\w+"

An -o/--only option (like grep) or -q/--quiet option (like many tools) that makes hyp output only the hyper://… url could be helpful.

Treora avatar Apr 05 '21 12:04 Treora

grep -oE "hyper://\w+"

depending on distro/version this is might not produce expected result,

grep -Eoe 'hyper://[0-9a-z]+' is more universal solution

dym-sh avatar Apr 15 '21 18:04 dym-sh

i can see the value for --only, but would --quiet option be usable in any way within context of the cli?

it will create new empty drive with unknown address and start seeding.. emptiness? like, its a cute metaphor, but not very actionable

dym-sh avatar Apr 16 '21 15:04 dym-sh

i can see the value for --only, but would --quiet option be usable in any way within context of the cli?

I suggested the two as alternative names for this option, not as two different options. Like with some other software, a single --quiet need not be completely silent (I’ve seen programs that hush all output if multiple -qs are passed).

Treora avatar Apr 20 '21 17:04 Treora

multiple -qs are passed

it's probably not entirely universal either:

$ docker ps -a -q
0169d163346e
$ docker ps -a
CONTAINER ID   IMAGE               COMMAND   CREATED          STATUS                    PORTS                                                                                                                                                                                                                 NAMES
0169d163346e   analogic/poste.io   "/init"   18 minutes ago   Up 18 minutes (healthy)   110/tcp, 143/tcp, 465/tcp, 0.0.0.0:25->25/tcp, :::25->25/tcp, 587/tcp, 995/tcp, 0.0.0.0:993->993/tcp, :::993->993/tcp, 4190/tcp, 0.0.0.0:12080->80/tcp, :::12080->80/tcp, 0.0.0.0:12443->443/tcp, :::12443->443/tcp   mailserver
$ docker ps -q
0169d163346e
$ docker ps -qq
0169d163346e
$ docker ps -q -q
0169d163346e
$ docker ps -qqq
0169d163346e
$ docker ps -q -q -q
0169d163346e

dym-sh avatar Apr 22 '21 09:04 dym-sh