jp (base, pubsub/set): new --quiet argument:
`--quiet` can be used to only return essential data from command. This is notably useful to remove message and trailing line feed when returning a data which must be parsed by an other program.
This commit is contained in:
parent
1d9d13dc04
commit
d818f1737b
1 changed files with 10 additions and 1 deletions
|
|
@ -734,6 +734,7 @@ class Set(base.CommandBase):
|
|||
host,
|
||||
"set",
|
||||
use_pubsub=True,
|
||||
use_quiet=True,
|
||||
pubsub_flags={C.NODE},
|
||||
help=_("publish a new item or update an existing one"),
|
||||
)
|
||||
|
|
@ -770,7 +771,10 @@ class Set(base.CommandBase):
|
|||
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
|
||||
else:
|
||||
if published_id:
|
||||
self.disp("Item published at {pub_id}".format(pub_id=published_id))
|
||||
if self.args.quiet:
|
||||
self.disp(published_id, end='')
|
||||
else:
|
||||
self.disp(f"Item published at {published_id}")
|
||||
else:
|
||||
self.disp("Item published")
|
||||
self.host.quit(C.EXIT_OK)
|
||||
|
|
|
|||
Loading…
Reference in a new issue