Skip to content

Commit

Permalink
new action workflow for Docker
Browse files Browse the repository at this point in the history
- new action workflow for Docker
- changed `--output raw` to print 1 line PER data-item, i.e. N lines with 1 JSON object each (instead of 1 line in TOTAL with a JSON array on N JSON objects)
- added code to cover --output for actions --listen and --tail
- see Issue #92
  • Loading branch information
8go committed Oct 5, 2022
1 parent 2fc05b9 commit 65e4f61
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ options:
information program will continue to run. This is
useful for having version number in the log files.
You are running version 3.5.3 2022-10-04. Enjoy, star on Github and contribute
You are running version 3.5.4 2022-10-05. Enjoy, star on Github and contribute
by submitting a Pull Request.
```

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.3
3.5.4
Binary file removed dist/matrix-commander-3.5.3.tar.gz
Binary file not shown.
Binary file added dist/matrix-commander-3.5.4.tar.gz
Binary file not shown.
Binary file removed dist/matrix_commander-3.5.3-py3-none-any.whl
Binary file not shown.
Binary file added dist/matrix_commander-3.5.4-py3-none-any.whl
Binary file not shown.
30 changes: 20 additions & 10 deletions matrix_commander/matrix_commander.py
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@
information program will continue to run. This is
useful for having version number in the log files.
You are running version 3.5.3 2022-10-04. Enjoy, star on Github and contribute
You are running version 3.5.4 2022-10-05. Enjoy, star on Github and contribute
by submitting a Pull Request.
```
Expand Down Expand Up @@ -1720,8 +1720,8 @@
HAVE_OPENID = False

# version number
VERSION = "2022-10-04"
VERSIONNR = "3.5.3"
VERSION = "2022-10-05"
VERSIONNR = "3.5.4"
# matrix-commander; for backwards compitability replace _ with -
PROG_WITHOUT_EXT = os.path.splitext(os.path.basename(__file__))[0].replace(
"_", "-"
Expand Down Expand Up @@ -2131,7 +2131,17 @@ async def message_callback(self, room: MatrixRoom, event): # noqa: C901
)
gs.log.debug(complete_msg)
# todo output format
print(complete_msg, flush=True) # print the received message
if (
gs.pa.output == OUTPUT_RAW_DETAILS
or gs.pa.output == OUTPUT_RAW
):
if gs.pa.output == OUTPUT_RAW:
dic = event.source
else:
dic = event
print(json.dumps(dic, default=obj_to_dict))
else: # default, gs.output == OUTPUT_HUMAN:
print(complete_msg, flush=True) # print the received message
if gs.pa.os_notify:
avatar_url = await get_avatar_url(self.client, event.sender)
notify(
Expand Down Expand Up @@ -4444,7 +4454,11 @@ async def listen_tail( # noqa: C901
room_id, start=resp_s.next_batch, limit=limit
)
if isinstance(resp, RoomMessagesError):
gs.log.debug(f"room_messages failed with resp = {resp}")
gs.log.warning(
f"room_messages failed with resp = {resp}. "
"Processing continues."
)
gs.warn_count += 1
continue # skip this room
gs.log.debug(f"room_messages response = {type(resp)} :: {resp}.")
gs.log.debug(f"room_messages room_id = {resp.room_id}.")
Expand Down Expand Up @@ -5112,7 +5126,6 @@ async def action_joined_members(
"Room list has been successfully overwritten with '*'"
)
rooms = resp.rooms # overwrite args with full list
rlist = [] # list of raw objects
for room in rooms:
room = room.replace(r"\!", "!") # remove possible escape
resp = await client.joined_members(room)
Expand All @@ -5130,7 +5143,7 @@ async def action_joined_members(
dic = resp.__dict__
if gs.pa.output == OUTPUT_RAW:
dic.pop("transport_response")
rlist.append(dic)
print(json.dumps(dic, default=obj_to_dict))
else: # default, gs.output == OUTPUT_HUMAN:
print(resp.room_id)
print(
Expand All @@ -5147,9 +5160,6 @@ async def action_joined_members(
),
sep="\n",
)
# todo output format ==> done
if gs.pa.output == OUTPUT_RAW_DETAILS or gs.pa.output == OUTPUT_RAW:
print(json.dumps(rlist, default=obj_to_dict))


async def action_mxc_to_http(client: AsyncClient, credentials: dict) -> None:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://packaging.python.org/en/latest/tutorials/packaging-projects/
# https://setuptools.pypa.io/en/latest/userguide/
name = matrix-commander
version = 3.5.3
version = 3.5.4
author = 8go
description = A simple command-line Matrix client
long_description = file: PyPi-Instructions.md, README.md
Expand Down

0 comments on commit 65e4f61

Please sign in to comment.