idea to avoid branching on startup #1

Closed
opened 2023-11-26 05:44:16 -05:00 by epogrebnyak · 10 comments
epogrebnyak commented 2023-11-26 05:44:16 -05:00 (Migrated from github.com)

dinosaurtirex/cmd-chat@2b2ec44999/cmd_chat/init.py#L30-L50

You can make two entry points for your program to avoid branching in run()

cmd-chat-server --ip ... --port ...
cmd-chat-client --ip ... --port ... --username ...

or maybe

cmd-chat serve IP_ADDRESS
cmd-chat connect IP_ADDRESS USERNAME

The command line interface can be docopt or click, with click you later move to terminal interface (TUI) via textual.

https://github.com/dinosaurtirex/cmd-chat/blob/2b2ec449992a91e4d7d3e81cad31768ea7425808/cmd_chat/__init__.py#L30-L50 You can make two entry points for your program to avoid branching in `run()` ``` cmd-chat-server --ip ... --port ... cmd-chat-client --ip ... --port ... --username ... ``` or maybe ``` cmd-chat serve IP_ADDRESS cmd-chat connect IP_ADDRESS USERNAME ``` The command line interface can be `docopt` or `click`, with `click` you later move to terminal interface (TUI) via `textual`.
emilycodestar commented 2023-11-26 21:02:15 -05:00 (Migrated from github.com)

It is very good idea. I will do it, thanks!

It is very good idea. I will do it, thanks!
emilycodestar commented 2023-11-26 22:50:43 -05:00 (Migrated from github.com)
Finally done in https://github.com/dinosaurtirex/cmd-chat/commit/e83f9e5368dd6c656f102faa2c5c1371bff79caa
epogrebnyak commented 2023-11-26 23:06:35 -05:00 (Migrated from github.com)

Nice! Have you thought of cmd-chat entry point so that the command is available after install?

Nice! Have you thought of cmd-chat entry point so that the command is available after install?
emilycodestar commented 2023-11-26 23:14:33 -05:00 (Migrated from github.com)

Nice! Have you thought of cmd-chat entry point so that the command is available after install?

I want to do it, but don't know really how it works. I tried several ways and it didn't work. If you have examples for how to do it, you can just simply make PR or some code snippets and i will add it.

> Nice! Have you thought of cmd-chat entry point so that the command is available after install? I want to do it, but don't know really how it works. I tried several ways and it didn't work. If you have examples for how to do it, you can just simply make PR or some code snippets and i will add it.
epogrebnyak commented 2023-11-26 23:33:10 -05:00 (Migrated from github.com)

Did send a link in about entry point in a reddit discussion, maybe you can open a separate issue on entry points and I can help with establishing it.

Did send a link in about entry point in a reddit discussion, maybe you can open a separate issue on entry points and I can help with establishing it.
emilycodestar commented 2023-11-27 02:12:32 -05:00 (Migrated from github.com)

Did send a link in about entry point in a reddit discussion, maybe you can open a separate issue on entry points and I can help with establishing it.

Got it! Thanks. I will try to do so

> Did send a link in about entry point in a reddit discussion, maybe you can open a separate issue on entry points and I can help with establishing it. Got it! Thanks. I will try to do so
emilycodestar commented 2023-11-27 06:11:46 -05:00 (Migrated from github.com)

Did send a link in about entry point in a reddit discussion, maybe you can open a separate issue on entry points and I can help with establishing it.

So i made it but got some weird sanic issue. I'll try to rewrite backend to flask and i hope today project will be updated

> Did send a link in about entry point in a reddit discussion, maybe you can open a separate issue on entry points and I can help with establishing it. So i made it but got some weird sanic issue. I'll try to rewrite backend to flask and i hope today project will be updated
emilycodestar commented 2023-11-27 06:30:24 -05:00 (Migrated from github.com)

So i actually did it. dinosaurtirex/cmd-chat@f24fc491d4

So i actually did it. https://github.com/dinosaurtirex/cmd-chat/commit/f24fc491d4e635336c388b318805901e58a240a1
epogrebnyak commented 2023-11-27 06:43:36 -05:00 (Migrated from github.com)

Sorry didn't not mean to break your backend. Entry point seems very cool now!

Sorry didn't not mean to break your backend. Entry point seems very cool now!
emilycodestar commented 2023-11-27 07:14:10 -05:00 (Migrated from github.com)

Sorry didn't not mean to break your backend. Entry point seems very cool now!

Ahahhah, not, it's not up to you. it's only because sanic has been updated and included some weird start logic.

> Sorry didn't not mean to break your backend. Entry point seems very cool now! Ahahhah, not, it's not up to you. it's only because sanic has been updated and included some weird start logic.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
emilycodestar/cmd-chat#1
No description provided.